Restore editor app feature test boundary
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "Project/ProjectPanel.h"
|
||||
#include "Ports/SystemInteractionPort.h"
|
||||
#include "Assets/BuiltInIcons.h"
|
||||
#include "SystemInteractionService.h"
|
||||
|
||||
#include "Panels/EditorPanelIds.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
namespace {
|
||||
|
||||
class FakeSystemInteractionHost final : public Ports::SystemInteractionPort {
|
||||
class FakeSystemInteractionHost final : public System::SystemInteractionService {
|
||||
public:
|
||||
bool CopyTextToClipboard(std::string_view text) override {
|
||||
lastClipboardText = std::string(text);
|
||||
@@ -88,15 +88,18 @@ private:
|
||||
std::filesystem::path m_root = {};
|
||||
};
|
||||
|
||||
UIEditorPanelContentHostFrame MakeProjectHostFrame() {
|
||||
UIEditorPanelContentHostFrame frame = {};
|
||||
UIEditorPanelContentHostPanelState panelState = {};
|
||||
panelState.panelId = std::string(kProjectPanelId);
|
||||
panelState.kind = UIEditorPanelPresentationKind::HostedContent;
|
||||
panelState.mounted = true;
|
||||
panelState.bounds = ::XCEngine::UI::UIRect(0.0f, 0.0f, 640.0f, 360.0f);
|
||||
frame.panelStates.push_back(std::move(panelState));
|
||||
return frame;
|
||||
UIEditorHostedPanelDispatchEntry MakeProjectDispatchEntry() {
|
||||
UIEditorHostedPanelDispatchEntry entry = {};
|
||||
entry.panelId = std::string(kProjectPanelId);
|
||||
entry.presentationKind = UIEditorPanelPresentationKind::HostedContent;
|
||||
entry.mounted = true;
|
||||
entry.bounds = ::XCEngine::UI::UIRect(0.0f, 0.0f, 640.0f, 360.0f);
|
||||
entry.allowInteraction = true;
|
||||
entry.attached = true;
|
||||
entry.visible = true;
|
||||
entry.active = true;
|
||||
entry.focused = true;
|
||||
return entry;
|
||||
}
|
||||
|
||||
::XCEngine::UI::UIInputEvent MakePointerButtonDown(
|
||||
@@ -110,13 +113,6 @@ UIEditorPanelContentHostFrame MakeProjectHostFrame() {
|
||||
return event;
|
||||
}
|
||||
|
||||
PanelInputContext MakeFocusedPanelInputContext() {
|
||||
PanelInputContext inputContext = {};
|
||||
inputContext.allowInteraction = true;
|
||||
inputContext.hasInputFocus = true;
|
||||
return inputContext;
|
||||
}
|
||||
|
||||
TEST(ProjectPanelTests, CreateFolderCommandCreatesDirectoryAndQueuesRename) {
|
||||
TemporaryRepo repo = {};
|
||||
|
||||
@@ -171,15 +167,13 @@ TEST(ProjectPanelTests, BackgroundContextMenuCreateFolderUsesCurrentFolder) {
|
||||
ProjectPanel panel = {};
|
||||
panel.Initialize(repo.Root());
|
||||
|
||||
const UIEditorPanelContentHostFrame hostFrame = MakeProjectHostFrame();
|
||||
const UIEditorHostedPanelDispatchEntry dispatchEntry = MakeProjectDispatchEntry();
|
||||
panel.Update(
|
||||
hostFrame,
|
||||
{ MakePointerButtonDown(520.0f, 180.0f, ::XCEngine::UI::UIPointerButton::Right) },
|
||||
MakeFocusedPanelInputContext());
|
||||
dispatchEntry,
|
||||
{ MakePointerButtonDown(520.0f, 180.0f, ::XCEngine::UI::UIPointerButton::Right) });
|
||||
panel.Update(
|
||||
hostFrame,
|
||||
{ MakePointerButtonDown(520.0f, 194.0f, ::XCEngine::UI::UIPointerButton::Left) },
|
||||
MakeFocusedPanelInputContext());
|
||||
dispatchEntry,
|
||||
{ MakePointerButtonDown(520.0f, 194.0f, ::XCEngine::UI::UIPointerButton::Left) });
|
||||
|
||||
EXPECT_TRUE(std::filesystem::exists(repo.Root() / "project/Assets/New Folder"));
|
||||
const UIEditorHostCommandEvaluationResult renameEvaluation =
|
||||
@@ -200,15 +194,13 @@ TEST(ProjectPanelTests, FolderContextMenuCreateFolderUsesFolderTarget) {
|
||||
ProjectPanel panel = {};
|
||||
panel.Initialize(repo.Root());
|
||||
|
||||
const UIEditorPanelContentHostFrame hostFrame = MakeProjectHostFrame();
|
||||
const UIEditorHostedPanelDispatchEntry dispatchEntry = MakeProjectDispatchEntry();
|
||||
panel.Update(
|
||||
hostFrame,
|
||||
{ MakePointerButtonDown(300.0f, 80.0f, ::XCEngine::UI::UIPointerButton::Right) },
|
||||
MakeFocusedPanelInputContext());
|
||||
dispatchEntry,
|
||||
{ MakePointerButtonDown(300.0f, 80.0f, ::XCEngine::UI::UIPointerButton::Right) });
|
||||
panel.Update(
|
||||
hostFrame,
|
||||
{ MakePointerButtonDown(320.0f, 120.0f, ::XCEngine::UI::UIPointerButton::Left) },
|
||||
MakeFocusedPanelInputContext());
|
||||
dispatchEntry,
|
||||
{ MakePointerButtonDown(320.0f, 120.0f, ::XCEngine::UI::UIPointerButton::Left) });
|
||||
|
||||
EXPECT_TRUE(std::filesystem::exists(repo.Root() / "project/Assets/FolderA/New Folder"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user