remove imgui_test_engine from editor namespace

This commit is contained in:
scawful
2024-07-31 07:41:34 -04:00
parent cfdefef2db
commit 439a55e3cb
6 changed files with 30 additions and 97 deletions

View File

@@ -1,15 +1,14 @@
#include "master_editor.h"
#include <ImGuiColorTextEdit/TextEditor.h>
#include <ImGuiFileDialog/ImGuiFileDialog.h>
#include <abseil-cpp/absl/strings/match.h>
#include <imgui/backends/imgui_impl_sdl2.h>
#include <imgui/backends/imgui_impl_sdlrenderer2.h>
#include <imgui/imgui.h>
#include <imgui/misc/cpp/imgui_stdlib.h>
#include <imgui_internal.h>
#include <imgui_memory_editor.h>
#include <imgui_test_engine/imgui_te_ui.h>
#include "ImGuiColorTextEdit/TextEditor.h"
#include "ImGuiFileDialog/ImGuiFileDialog.h"
#include "abseil-cpp/absl/strings/match.h"
#include "imgui/backends/imgui_impl_sdl2.h"
#include "imgui/backends/imgui_impl_sdlrenderer2.h"
#include "imgui/imgui.h"
#include "imgui/misc/cpp/imgui_stdlib.h"
#include "imgui_internal.h"
#include "imgui_memory_editor.h"
#include "absl/status/status.h"
#include "app/core/common.h"
@@ -682,8 +681,6 @@ void MasterEditor::DrawTestMenu() {
EndMenu();
}
if (show_tests_)
ImGuiTestEngine_ShowTestEngineWindows(test_engine, &show_tests_);
}
void MasterEditor::DrawProjectMenu() {

View File

@@ -3,18 +3,16 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#include <ImGuiColorTextEdit/TextEditor.h>
#include <ImGuiFileDialog/ImGuiFileDialog.h>
#include <imgui/imgui.h>
#include <imgui/misc/cpp/imgui_stdlib.h>
#include <imgui_memory_editor.h>
#include <imgui_test_engine/imgui_te_context.h>
#include "ImGuiColorTextEdit/TextEditor.h"
#include "ImGuiFileDialog/ImGuiFileDialog.h"
#include "imgui/imgui.h"
#include "imgui/misc/cpp/imgui_stdlib.h"
#include "imgui_memory_editor.h"
#include "absl/status/status.h"
#include "app/core/common.h"
#include "app/core/constants.h"
#include "app/core/project.h"
#include "app/core/testable.h"
#include "app/editor/code/assembly_editor.h"
#include "app/editor/code/memory_editor.h"
#include "app/editor/dungeon/dungeon_editor.h"
@@ -59,8 +57,7 @@ namespace editor {
*/
class MasterEditor : public SharedRom,
public context::GfxContext,
public core::ExperimentFlags,
public core::GuiTestable {
public core::ExperimentFlags {
public:
MasterEditor() {
current_editor_ = &overworld_editor_;
@@ -79,8 +76,6 @@ class MasterEditor : public SharedRom,
auto emulator() -> emu::Emulator& { return emulator_; }
auto quit() { return quit_; }
void RegisterTests(ImGuiTestEngine* e) override;
private:
void ManageActiveEditors();
void ManageKeyboardShortcuts();
@@ -142,4 +137,4 @@ class MasterEditor : public SharedRom,
} // namespace app
} // namespace yaze
#endif // YAZE_APP_EDITOR_MASTER_EDITOR_H
#endif // YAZE_APP_EDITOR_MASTER_EDITOR_H

View File

@@ -4,42 +4,6 @@ namespace yaze {
namespace app {
namespace editor {
void MasterEditor::RegisterTests(ImGuiTestEngine* e) {
message_editor_.RegisterTests(e);
test_engine = e;
ImGuiTest* t = nullptr;
t = IM_REGISTER_TEST(e, "master_editor", "open_rom");
t->GuiFunc = [](ImGuiTestContext* ctx) {
IM_UNUSED(ctx);
ImGui::Begin("Test Window", nullptr, ImGuiWindowFlags_NoSavedSettings);
ImGui::Text("Hello, automation world");
ImGui::Button("Click Me");
if (ImGui::TreeNode("Node")) {
static bool b = false;
ImGui::Checkbox("Checkbox", &b);
ImGui::TreePop();
}
ImGui::End();
};
t->TestFunc = [](ImGuiTestContext* ctx) {
ctx->SetRef("Test Window");
ctx->ItemClick("Click Me");
ctx->ItemOpen("Node"); // Optional as ItemCheck("Node/Checkbox") can do it
ctx->ItemCheck("Node/Checkbox");
ctx->ItemUncheck("Node/Checkbox");
};
t = IM_REGISTER_TEST(e, "master_editor", "open_metrics");
t->GuiFunc = [](ImGuiTestContext* ctx) {
IM_UNUSED(ctx);
ImGui::ShowMetricsWindow();
};
t->TestFunc = [](ImGuiTestContext* ctx) {
ctx->SetRef("Dear ImGui Metrics");
};
}
} // namespace editor
} // namespace app

View File

@@ -1,16 +1,15 @@
#include "message_editor.h"
#include <absl/status/status.h>
#include <absl/strings/str_format.h>
#include <absl/strings/str_replace.h>
#include <absl/strings/str_split.h>
#include <regex>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/str_split.h"
#include "app/core/common.h"
#include "app/editor/utils/editor.h"
#include "app/gfx/bitmap.h"
@@ -525,8 +524,7 @@ string MessageEditor::ParseTextDataByte(uint8_t value) {
}
void MessageEditor::DrawTileToPreview(int x, int y, int srcx, int srcy, int pal,
bool mirror_x, bool mirror_y, int sizex,
int sizey) {
int sizex, int sizey) {
int drawid = srcx + (srcy * 32);
for (int yl = 0; yl < sizey * 8; yl++) {
for (int xl = 0; xl < 4; xl++) {
@@ -580,8 +578,7 @@ void MessageEditor::DrawCharacterToPreview(const std::vector<uint8_t>& text) {
text_line++;
}
DrawTileToPreview(text_pos, text_line * 16, srcx, srcy, 0, false, false,
1, 2);
DrawTileToPreview(text_pos, text_line * 16, srcx, srcy, 0, 1, 2);
text_pos += width_array[value];
} else if (value == kLine1) {
text_pos = 0;

View File

@@ -1,11 +1,6 @@
#ifndef YAZE_APP_EDITOR_MESSAGE_EDITOR_H
#define YAZE_APP_EDITOR_MESSAGE_EDITOR_H
#include <absl/status/status.h>
#include <absl/strings/str_format.h>
#include <absl/strings/str_replace.h>
#include <absl/strings/str_split.h>
#include <iostream>
#include <regex>
#include <sstream>
@@ -13,7 +8,10 @@
#include <unordered_map>
#include <vector>
#include "app/core/testable.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/str_split.h"
#include "app/editor/message/message_data.h"
#include "app/editor/utils/editor.h"
#include "app/gfx/bitmap.h"
@@ -185,9 +183,7 @@ static const std::unordered_map<uint8_t, wchar_t> CharEncoder = {
static TextElement DictionaryElement =
TextElement(0x80, DICTIONARYTOKEN, true, "Dictionary");
class MessageEditor : public Editor,
public SharedRom,
public core::GuiTestable {
class MessageEditor : public Editor, public SharedRom {
public:
struct DictionaryEntry {
uint8_t ID;
@@ -242,7 +238,7 @@ class MessageEditor : public Editor,
absl::Status Save();
void Delete();
void SelectAll();
void RegisterTests(ImGuiTestEngine* e) override;
// void RegisterTests(ImGuiTestEngine* e) override;
TextElement FindMatchingCommand(uint8_t byte);
TextElement FindMatchingSpecial(uint8_t value);
@@ -252,7 +248,6 @@ class MessageEditor : public Editor,
static uint8_t FindDictionaryEntry(uint8_t value);
static uint8_t FindMatchingCharacter(char value);
void DrawTileToPreview(int x, int y, int srcx, int srcy, int pal,
bool mirror_x = false, bool mirror_y = false,
int sizex = 1, int sizey = 1);
void DrawCharacterToPreview(char c);
void DrawCharacterToPreview(const std::vector<uint8_t>& text);
@@ -368,4 +363,4 @@ static std::vector<MessageEditor::DictionaryEntry> AllDictionaries;
} // namespace app
} // namespace yaze
#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H
#endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H

View File

@@ -1,22 +1,7 @@
#include "message_editor.h"
#include "app/core/testable.h"
namespace yaze {
namespace app {
namespace editor {
void MessageEditor::RegisterTests(ImGuiTestEngine* e) {
test_engine = e;
ImGuiTest* t = nullptr;
t = IM_REGISTER_TEST(e, "message_editor", "read_all_text_data");
t->TestFunc = [](ImGuiTestContext* ctx) {
ctx->SetRef("##YazeMain/##TabBar/Message");
};
}
} // namespace editor
namespace editor {} // namespace editor
} // namespace app
} // namespace yaze