summaryrefslogtreecommitdiffhomepage
path: root/editor/tests.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-27 13:27:34 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-27 13:27:34 +0100
commit07d7c30d33a3adfc24031d63582ac0b7b71bd96b (patch)
tree8c958a810cd19b0de857276a542dfd1d43215fe6 /editor/tests.cpp
parent2828671f29154e244fd826b71e0458b2f7dfcba9 (diff)
wip
Diffstat (limited to 'editor/tests.cpp')
-rw-r--r--editor/tests.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/editor/tests.cpp b/editor/tests.cpp
index 1521fff7..f7d7565e 100644
--- a/editor/tests.cpp
+++ b/editor/tests.cpp
@@ -9,6 +9,8 @@
namespace floormat::tests {
+static_assert(arraySize(tests_data::fields) == (size_t)Test::COUNT);
+
void label_left(StringView label, float width)
{
float x = ImGui::GetCursorPosX();
@@ -18,7 +20,7 @@ void label_left(StringView label, float width)
ImGui::SetNextItemWidth(-1);
}
-std::unique_ptr<base_test> tests_data::make_test_none() { return {}; }
+Pointer<base_test> tests_data::make_test_none() { return {}; }
} // namespace floormat::tests
@@ -38,7 +40,7 @@ using namespace floormat::imgui;
void tests_data::switch_to(Test i)
{
- fm_assert((size_t)i < std::size(fields));
+ fm_assert((size_t)i < arraySize(fields));
current_index = Test::none;
current_test = make_test_none();
switch (i)
@@ -58,13 +60,13 @@ safe_ptr<tests_data_> tests_data_::make()
void app::tests_pre_update()
{
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
x->update_pre(*this);
}
void app::tests_post_update()
{
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
x->update_post(*this);
}
@@ -72,7 +74,7 @@ bool app::tests_handle_mouse_click(const mouse_button_event& e, bool is_down)
{
update_cursor_tile(cursor.pixel);
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
return x->handle_mouse_click(*this, e, is_down);
else
return false;
@@ -80,7 +82,7 @@ bool app::tests_handle_mouse_click(const mouse_button_event& e, bool is_down)
bool app::tests_handle_key(const key_event& e, bool is_down)
{
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
return x->handle_key(*this, e, is_down);
else
return false;
@@ -88,7 +90,7 @@ bool app::tests_handle_key(const key_event& e, bool is_down)
bool app::tests_handle_mouse_move(const mouse_move_event& e)
{
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
return x->handle_mouse_move(*this, e);
else
return false;
@@ -128,7 +130,7 @@ void app::draw_tests_pane(float width)
void app::draw_tests_overlay()
{
- if (const auto& x = tests().current_test)
+ if (auto& x = tests().current_test)
x->draw_overlay(*this);
}