Skip to content

Commit

Permalink
TestSuite: amend "widgets_disabled_nested", "inputs_io_capture_on_rel…
Browse files Browse the repository at this point in the history
…ease_not_owned"

Didn't probably update version number at the time of committing ocornut/imgui#7640
  • Loading branch information
ocornut committed Jul 1, 2024
1 parent 1780341 commit 5b6216c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ CHANGELOG
Those changes are not all listed here.
** For a while this is going to ONLY INCLUDE BREAKING CHANGES.

2024/07/01:
- TestEngine: added helper IM_CHECK_FLOAT_NE_EPS() macro.

2024/06/06:
- TestEngine: WindowInfo() with ImGuiTestOpFlags_NoError doesn't spew error
messages in log. (#52)
Expand Down
1 change: 1 addition & 0 deletions imgui_test_engine/imgui_te_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ template<> inline void ImGuiTestEngineUtil_appendf_auto(ImGuiTextBuffer* buf, Im

// Floating point compares
#define IM_CHECK_FLOAT_EQ_EPS(_LHS, _RHS) IM_CHECK_LE(ImFabs(_LHS - (_RHS)), FLT_EPSILON) // Float Equal
#define IM_CHECK_FLOAT_NE_EPS(_LHS, _RHS) IM_CHECK_GT(ImFabs(_LHS - (_RHS)), FLT_EPSILON) // Float Not Equal
#define IM_CHECK_FLOAT_NEAR(_LHS, _RHS, _EPS) IM_CHECK_LE(ImFabs(_LHS - (_RHS)), _EPS)
#define IM_CHECK_FLOAT_NEAR_NO_RET(_LHS, _RHS, _E) IM_CHECK_LE_NO_RET(ImFabs(_LHS - (_RHS)), _E)

Expand Down
2 changes: 1 addition & 1 deletion imgui_test_suite/imgui_tests_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void RegisterTests_Inputs(ImGuiTestEngine* e)
IM_CHECK_EQ(g.ActiveId, 0u);

ctx->MouseUp(0); // Include a yield
#if IMGUI_BROKEN_TESTS // Test bug reported by #1392
#if IMGUI_VERSION_NUM >= 19085 // Test bug reported by #1392
IM_CHECK_EQ(g.IO.WantCaptureMouse, false);
#endif

Expand Down
7 changes: 6 additions & 1 deletion imgui_test_suite/imgui_tests_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5526,8 +5526,13 @@ void RegisterTests_Widgets(ImGuiTestEngine* e)
IM_CHECK_FLOAT_EQ_EPS(ImGui::GetStyle().Alpha, 1.0f * 0.4f);

ImGui::Begin("Nested window call");
IM_CHECK((g.CurrentItemFlags& ImGuiItemFlags_Disabled) == 0);
#if IMGUI_VERSION_NUM >= 19085
IM_CHECK((g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0);
IM_CHECK_FLOAT_NE_EPS(ImGui::GetStyle().Alpha, 1.0f);
#else
IM_CHECK((g.CurrentItemFlags & ImGuiItemFlags_Disabled) == 0);
IM_CHECK_FLOAT_EQ_EPS(ImGui::GetStyle().Alpha, 1.0f);
#endif

ImGui::End();
IM_CHECK((g.CurrentItemFlags & ImGuiItemFlags_Disabled) != 0);
Expand Down

0 comments on commit 5b6216c

Please sign in to comment.