From eaca66486a408e27669d10f77dd0077a1ee29214 Mon Sep 17 00:00:00 2001 From: Ondra Voves Date: Fri, 3 Oct 2025 18:37:40 +0200 Subject: [PATCH] Some fix for zig 0.15.1 --- build.zig | 15 +++- libs/imgui_test_engine/imgui_capture_tool.cpp | 5 ++ libs/imgui_test_engine/imgui_capture_tool.h | 3 + libs/imgui_test_engine/imgui_te_context.cpp | 44 +++++++++-- libs/imgui_test_engine/imgui_te_context.h | 5 +- libs/imgui_test_engine/imgui_te_coroutine.cpp | 3 + libs/imgui_test_engine/imgui_te_coroutine.h | 3 + libs/imgui_test_engine/imgui_te_engine.cpp | 78 +++++++++++++------ libs/imgui_test_engine/imgui_te_engine.h | 18 ++++- libs/imgui_test_engine/imgui_te_exporters.cpp | 19 +++-- libs/imgui_test_engine/imgui_te_exporters.h | 3 + libs/imgui_test_engine/imgui_te_imconfig.h | 10 +++ libs/imgui_test_engine/imgui_te_internal.h | 3 + libs/imgui_test_engine/imgui_te_perftool.cpp | 9 ++- libs/imgui_test_engine/imgui_te_perftool.h | 3 + libs/imgui_test_engine/imgui_te_ui.cpp | 3 + libs/imgui_test_engine/imgui_te_ui.h | 3 + libs/imgui_test_engine/imgui_te_utils.cpp | 39 ++++++++-- libs/imgui_test_engine/imgui_te_utils.h | 3 + .../thirdparty/Str/.editorconfig | 5 ++ .../thirdparty/Str/Str.natvis | 14 ++++ src/backend_dx12.zig | 4 +- src/backend_glfw_vulkan.zig | 2 +- src/backend_vulkan.zig | 6 +- src/gui.zig | 10 +-- src/node_editor.zig | 10 +-- src/te.zig | 8 +- src/zgui.cpp | 6 +- src/zte.cpp | 10 +-- 29 files changed, 269 insertions(+), 75 deletions(-) create mode 100644 libs/imgui_test_engine/thirdparty/Str/.editorconfig create mode 100644 libs/imgui_test_engine/thirdparty/Str/Str.natvis diff --git a/build.zig b/build.zig index 76f04fa..4e96b19 100644 --- a/build.zig +++ b/build.zig @@ -69,6 +69,11 @@ pub fn build(b: *std.Build) void { "use_32bit_draw_idx", "Use 32-bit draw index", ) orelse false, + .disable_obsolete = b.option( + bool, + "disable_obsolete", + "Disable obsolete imgui functions", + ) orelse true, }; const options_step = b.addOptions(); @@ -107,7 +112,11 @@ pub fn build(b: *std.Build) void { }), }); - imgui.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS", ""); + imgui.root_module.addCMacro("IMGUI_IMPL_API", "extern \"C\""); + + if (options.disable_obsolete) { + imgui.root_module.addCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS", ""); + } if (options.shared) { if (target.result.os.tag == .windows) { @@ -437,6 +446,10 @@ pub fn build(b: *std.Build) void { imgui.addSystemIncludePath(system_sdk.path("macos12/usr/include")); imgui.addFrameworkPath(system_sdk.path("macos12/System/Library/Frameworks")); } + } else if (target.result.os.tag == .linux) { + if (b.lazyDependency("system_sdk", .{})) |system_sdk| { + imgui.addSystemIncludePath(system_sdk.path("linux/include")); + } } const test_step = b.step("test", "Run zgui tests"); diff --git a/libs/imgui_test_engine/imgui_capture_tool.cpp b/libs/imgui_test_engine/imgui_capture_tool.cpp index d12ca6b..9e888bf 100644 --- a/libs/imgui_test_engine/imgui_capture_tool.cpp +++ b/libs/imgui_test_engine/imgui_capture_tool.cpp @@ -2,6 +2,9 @@ // (screen/video capture tool) // This is usable as a standalone applet or controlled by the test engine. +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + // Two mode of operation: // - Interactive: call ImGuiCaptureToolUI::ShowCaptureToolWindow() // - Programmatic: generally via ImGuiTestContext::CaptureXXX functions @@ -203,6 +206,7 @@ void ImGuiCaptureContext::PreRender() if (IsCapturing()) { const ImGuiCaptureArgs* args = _CaptureArgs; + IM_ASSERT(args != NULL); g.IO.MouseDrawCursor = !(args->InFlags & ImGuiCaptureFlags_HideMouseCursor); } } @@ -615,6 +619,7 @@ void ImGuiCaptureContext::EndVideoCapture() IM_ASSERT(_VideoRecording == true); _VideoRecording = false; + _CaptureArgs = nullptr; } bool ImGuiCaptureContext::IsCapturingVideo() diff --git a/libs/imgui_test_engine/imgui_capture_tool.h b/libs/imgui_test_engine/imgui_capture_tool.h index e58ea6f..946c65b 100644 --- a/libs/imgui_test_engine/imgui_capture_tool.h +++ b/libs/imgui_test_engine/imgui_capture_tool.h @@ -2,6 +2,9 @@ // (screen/video capture tool) // This is usable as a standalone applet or controlled by the test engine. +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once // Need "imgui_te_engine.h" included for ImFuncPtr diff --git a/libs/imgui_test_engine/imgui_te_context.cpp b/libs/imgui_test_engine/imgui_te_context.cpp index 6bafed0..6d305c7 100644 --- a/libs/imgui_test_engine/imgui_te_context.cpp +++ b/libs/imgui_test_engine/imgui_te_context.cpp @@ -2,6 +2,9 @@ // (context when a running test + end user automation API) // This is the main (if not only) interface that your Tests will be using. +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif @@ -1622,7 +1625,13 @@ void ImGuiTestContext::_MakeAimingSpaceOverPos(ImGuiViewport* viewport, ImGuiWin LogDebug("_MakeAimingSpaceOverPos(over_window = '%s', over_pos = %.2f,%.2f)", over_window ? over_window->Name : "N/A", over_pos.x, over_pos.y); const int over_window_n = (over_window != nullptr) ? ImGui::FindWindowDisplayIndex(over_window) : -1; - const ImVec2 window_min_pos = over_pos + g.WindowsHoverPadding + ImVec2(1.0f, 1.0f); +#if IMGUI_VERSION_NUM < 19183 + const ImVec2 hover_padding = g.WindowsHoverPadding; +#else + const ImVec2 hover_padding = ImVec2(g.WindowsBorderHoverPadding, g.WindowsBorderHoverPadding); +#endif + + const ImVec2 window_min_pos = over_pos + hover_padding + ImVec2(1.0f, 1.0f); for (int window_n = g.Windows.Size - 1; window_n > over_window_n; window_n--) { ImGuiWindow* window = g.Windows[window_n]; @@ -1732,11 +1741,16 @@ void ImGuiTestContext::MouseMove(ImGuiTestRef ref, ImGuiTestOpFlags flags) // Check visibility and scroll if necessary { +#if IMGUI_VERSION_NUM < 19183 + const ImVec2 hover_padding = g.WindowsHoverPadding; +#else + const ImVec2 hover_padding = ImVec2(g.WindowsBorderHoverPadding, g.WindowsBorderHoverPadding); +#endif if (item.NavLayer == ImGuiNavLayer_Main) { float min_visible_size = 10.0f; - float min_window_size_x = window->DecoInnerSizeX1 + window->DecoOuterSizeX1 + window->DecoOuterSizeX2 + min_visible_size + g.WindowsHoverPadding.x * 2.0f; - float min_window_size_y = window->DecoInnerSizeY1 + window->DecoOuterSizeY1 + window->DecoOuterSizeY2 + min_visible_size + g.WindowsHoverPadding.y * 2.0f; + float min_window_size_x = window->DecoInnerSizeX1 + window->DecoOuterSizeX1 + window->DecoOuterSizeX2 + min_visible_size + hover_padding.x * 2.0f; + float min_window_size_y = window->DecoInnerSizeY1 + window->DecoOuterSizeY1 + window->DecoOuterSizeY2 + min_visible_size + hover_padding.y * 2.0f; if ((window->Size.x < min_window_size_x || window->Size.y < min_window_size_y) && (window->Flags & ImGuiWindowFlags_NoResize) == 0 && (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) { LogDebug("MouseMove: Will attempt to resize window to make item in main scrolling layer visible."); @@ -1749,7 +1763,7 @@ void ImGuiTestContext::MouseMove(ImGuiTestRef ref, ImGuiTestOpFlags flags) } ImRect window_r = window->InnerClipRect; - window_r.Expand(ImVec2(-g.WindowsHoverPadding.x, -g.WindowsHoverPadding.y)); + window_r.Expand(ImVec2(-hover_padding.x, -hover_padding.y)); ImRect item_r_clipped; item_r_clipped.Min.x = ImClamp(item.RectFull.Min.x, window_r.Min.x, window_r.Max.x); @@ -1862,7 +1876,11 @@ void ImGuiTestContext::MouseMove(ImGuiTestRef ref, ImGuiTestOpFlags flags) if (is_hovering_resize_corner) { LogDebug("MouseMove: Child obstructed by parent's ResizeGrip, trying to resize window and trying again.."); +#if IMGUI_VERSION_NUM < 19172 float extra_size = window->CalcFontSize() * 3.0f; +#else + float extra_size = window->FontRefSize * 3.0f; +#endif WindowResize(window->ID, window->Size + ImVec2(extra_size, extra_size)); MouseMove(ref, flags | ImGuiTestOpFlags_IsSecondAttempt); return; @@ -1985,6 +2003,11 @@ void ImGuiTestContext::_ForeignWindowsHideOverPos(const ImVec2& pos, ImGuiWindow for (int i = 0; ignore_list[i]; i++) min_window_index = ImMin(min_window_index, ImGui::FindWindowDisplayIndex(ignore_list[i])); +#if IMGUI_VERSION_NUM < 19183 + const ImVec2 hover_padding = g.WindowsHoverPadding; +#else + const ImVec2 hover_padding = ImVec2(g.WindowsBorderHoverPadding, g.WindowsBorderHoverPadding); +#endif bool hidden_windows = false; for (int i = 0; i < g.Windows.Size; i++) { @@ -1992,7 +2015,7 @@ void ImGuiTestContext::_ForeignWindowsHideOverPos(const ImVec2& pos, ImGuiWindow if (other_window->RootWindow == other_window && other_window->WasActive) { ImRect r = other_window->Rect(); - r.Expand(g.WindowsHoverPadding); + r.Expand(hover_padding); if (r.Contains(pos)) { for (int j = 0; ignore_list[j]; j++) @@ -2293,6 +2316,11 @@ ImGuiWindow* ImGuiTestContext::FindHoveredWindowAtPos(const ImVec2& pos) static bool IsPosOnVoid(ImGuiContext& g, const ImVec2& pos) { +#if IMGUI_VERSION_NUM < 19183 + const ImVec2 hover_padding = g.WindowsHoverPadding; +#else + const ImVec2 hover_padding = ImVec2(g.WindowsBorderHoverPadding, g.WindowsBorderHoverPadding); +#endif for (ImGuiWindow* window : g.Windows) #ifdef IMGUI_HAS_DOCK if (window->RootWindowDockTree == window && window->WasActive) @@ -2301,7 +2329,7 @@ static bool IsPosOnVoid(ImGuiContext& g, const ImVec2& pos) #endif { ImRect r = window->Rect(); - r.Expand(g.WindowsHoverPadding); + r.Expand(hover_padding); if (r.Contains(pos)) return false; } @@ -3497,7 +3525,11 @@ void ImGuiTestContext::MenuAction(ImGuiTestAction action, ImGuiTestRef ref) ItemAction(Inputs->MouseButtonsValue ? ImGuiTestAction_Hover : ImGuiTestAction_Click, buf.c_str()); } } +#if IMGUI_VERSION_NUM < 19187 current_window = GetWindowByRef(Str16f("//##Menu_%02d", depth).c_str()); +#else + current_window = GetWindowByRef(Str16f("//###Menu_%02d", depth).c_str()); +#endif IM_CHECK_SILENT(current_window != nullptr); path = p + 1; diff --git a/libs/imgui_test_engine/imgui_te_context.h b/libs/imgui_test_engine/imgui_te_context.h index 094504a..2aaab44 100644 --- a/libs/imgui_test_engine/imgui_te_context.h +++ b/libs/imgui_test_engine/imgui_te_context.h @@ -2,6 +2,9 @@ // (context when a running test + end user automation API) // This is the main (if not only) interface that your Tests will be using. +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once #include "imgui.h" @@ -167,6 +170,7 @@ struct IMGUI_API ImGuiTestGenericItemStatus void Clear() { memset(this, 0, sizeof(*this)); } void QuerySet(bool ret_val = false) { Clear(); QueryInc(ret_val); } void QueryInc(bool ret_val = false) { RetValue += ret_val; Hovered += ImGui::IsItemHovered(); Active += ImGui::IsItemActive(); Focused += ImGui::IsItemFocused(); Clicked += ImGui::IsItemClicked(); Visible += ImGui::IsItemVisible(); Edited += ImGui::IsItemEdited(); Activated += ImGui::IsItemActivated(); Deactivated += ImGui::IsItemDeactivated(); DeactivatedAfterEdit += ImGui::IsItemDeactivatedAfterEdit(); } + void Draw() { ImGui::Text("Ret: %d, Hovered: %d, Active: %d, Focused: %d\nClicked: %d, Visible: %d, Edited: %d\nActivated: %d, Deactivated: %d, DeactivatedAfterEdit: %d", RetValue, Hovered, Active, Focused, Clicked, Visible, Edited, Activated, Deactivated, DeactivatedAfterEdit); } }; // Generic structure with various storage fields. @@ -422,7 +426,6 @@ struct IMGUI_API ImGuiTestContext void ItemClose(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0) { ItemAction(ImGuiTestAction_Close, ref, flags); } void ItemInput(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0) { ItemAction(ImGuiTestAction_Input, ref, flags); } void ItemNavActivate(ImGuiTestRef ref, ImGuiTestOpFlags flags = 0) { ItemAction(ImGuiTestAction_NavActivate, ref, flags); } - bool ItemOpenFullPath(ImGuiTestRef); // Item/Widgets: Batch actions over an entire scope void ItemActionAll(ImGuiTestAction action, ImGuiTestRef ref_parent, const ImGuiTestActionFilter* filter = nullptr); diff --git a/libs/imgui_test_engine/imgui_te_coroutine.cpp b/libs/imgui_test_engine/imgui_te_coroutine.cpp index 8170034..a10bd98 100644 --- a/libs/imgui_test_engine/imgui_te_coroutine.cpp +++ b/libs/imgui_test_engine/imgui_te_coroutine.cpp @@ -2,6 +2,9 @@ // (coroutine interface + optional implementation) // Read https://github.com/ocornut/imgui_test_engine/wiki/Setting-Up +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #include "imgui_te_coroutine.h" #include "imgui.h" diff --git a/libs/imgui_test_engine/imgui_te_coroutine.h b/libs/imgui_test_engine/imgui_te_coroutine.h index c9f16c7..858f9ab 100644 --- a/libs/imgui_test_engine/imgui_te_coroutine.h +++ b/libs/imgui_test_engine/imgui_te_coroutine.h @@ -2,6 +2,9 @@ // (coroutine interface + optional implementation) // Read https://github.com/ocornut/imgui_test_engine/wiki/Setting-Up +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once #ifndef IMGUI_VERSION diff --git a/libs/imgui_test_engine/imgui_te_engine.cpp b/libs/imgui_test_engine/imgui_te_engine.cpp index d2920ce..91d752f 100644 --- a/libs/imgui_test_engine/imgui_te_engine.cpp +++ b/libs/imgui_test_engine/imgui_te_engine.cpp @@ -3,6 +3,9 @@ // This is the interface that your initial setup (app init, main loop) will mostly be using. // Actual tests will mostly use the interface of imgui_te_context.h +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif @@ -24,7 +27,9 @@ #include // SetUnhandledExceptionFilter() #undef Yield // Undo some of the damage done by #else +#if !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE #include // signal() +#endif #include // sleep() #endif @@ -322,7 +327,11 @@ void ImGuiTestEngine_RebootUiContext(ImGuiTestEngine* engine) ImGuiTestEngine_UnbindImGuiContext(engine, ctx); // Backup +#ifdef IMGUI_HAS_TEXTURES + ImGuiContext* backup_atlas_owner = ctx->IO.Fonts->OwnerContext; +#else bool backup_atlas_owned_by_context = ctx->FontAtlasOwnedByContext; +#endif ImFontAtlas* backup_atlas = ctx->IO.Fonts; ImGuiIO backup_io = ctx->IO; #ifdef IMGUI_HAS_VIEWPORT @@ -336,7 +345,11 @@ void ImGuiTestEngine_RebootUiContext(ImGuiTestEngine* engine) #endif // Recreate +#ifdef IMGUI_HAS_TEXTURES + ctx->IO.Fonts->OwnerContext = backup_atlas_owner; +#else ctx->FontAtlasOwnedByContext = false; +#endif #if 1 ImGui::DestroyContext(); ImGui::CreateContext(backup_atlas); @@ -349,7 +362,11 @@ void ImGuiTestEngine_RebootUiContext(ImGuiTestEngine* engine) #endif // Restore +#ifdef IMGUI_HAS_TEXTURES + ctx->IO.Fonts->OwnerContext = ctx; +#else ctx->FontAtlasOwnedByContext = backup_atlas_owned_by_context; +#endif ctx->IO = backup_io; #ifdef IMGUI_HAS_VIEWPORT //backup_platform_io.Viewports.swap(ctx->PlatformIO.Viewports); @@ -542,15 +559,15 @@ void ImGuiTestEngine_ApplyInputToImGuiContext(ImGuiTestEngine* engine) if (g.InputEventsQueue[n].AddedByTestEngine == false) g.InputEventsQueue.erase(&g.InputEventsQueue[n--]); - // Special flags to stop submitting events - if (engine->TestContext->RunFlags & ImGuiTestRunFlags_EnableRawInputs) - return; - // To support using ImGuiKey_NavXXXX shortcuts pointing to gamepad actions // FIXME-TEST-ENGINE: Should restore g.IO.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; g.IO.BackendFlags |= ImGuiBackendFlags_HasGamepad; + // Special flags to stop submitting events + if (engine->TestContext->RunFlags & ImGuiTestRunFlags_EnableRawInputs) + return; + const int input_event_count_prev = g.InputEventsQueue.Size; // Apply mouse viewport @@ -1453,21 +1470,30 @@ void ImGuiTestEngine_UpdateTestsSourceLines(ImGuiTestEngine* engine) } } -void ImGuiTestEngine_GetResult(ImGuiTestEngine* engine, int& count_tested, int& count_success) +// count_remaining could be >0 if e.g. called during a crash handler or aborting a run. +void ImGuiTestEngine_GetResultSummary(ImGuiTestEngine* engine, ImGuiTestEngineResultSummary* out_results) { - count_tested = 0; - count_success = 0; + int count_tested = 0; + int count_success = 0; + int count_remaining = 0; for (int n = 0; n < engine->TestsAll.Size; n++) { ImGuiTest* test = engine->TestsAll[n]; if (test->Output.Status == ImGuiTestStatus_Unknown) continue; - IM_ASSERT(test->Output.Status != ImGuiTestStatus_Queued); + if (test->Output.Status == ImGuiTestStatus_Queued) + { + count_remaining++; + continue; + } IM_ASSERT(test->Output.Status != ImGuiTestStatus_Running); count_tested++; if (test->Output.Status == ImGuiTestStatus_Success) count_success++; } + out_results->CountTested = count_tested; + out_results->CountSuccess = count_success; + out_results->CountInQueue = count_remaining; } // Get a copy of the test list @@ -1625,6 +1651,7 @@ void ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* parent_c test_output->EndTime = test_output->StartTime; ctx->Test = nullptr; ctx->TestOutput = nullptr; + ctx->CaptureArgs = nullptr; return; } @@ -1874,7 +1901,7 @@ void ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* parent_c // Additional yields to avoid consecutive tests who may share identifiers from missing their window/item activation. ctx->RunFlags |= ImGuiTestRunFlags_GuiFuncDisable; - ctx->Yield(2); + ctx->Yield(3); // Restore active func ctx->ActiveFunc = backup_active_func; @@ -1907,6 +1934,11 @@ void ImGuiTestEngine_RunTest(ImGuiTestEngine* engine, ImGuiTestContext* parent_c } } + // 'ctx' at this point is either a local variable or shared with parent. + //ctx->Test = nullptr; + //ctx->TestOutput = nullptr; + //ctx->CaptureArgs = nullptr; + IM_ASSERT(engine->TestContext == ctx); engine->TestContext = parent_ctx; } @@ -1999,30 +2031,32 @@ void ImGuiTestEngine_ErrorRecoveryRun(ImGuiTestEngine* engine) void ImGuiTestEngine_CrashHandler() { + ImGuiContext& g = *GImGui; + ImGuiTestEngine* engine = (ImGuiTestEngine*)g.TestEngine; + ImGuiTest* crashed_test = (engine->TestContext && engine->TestContext->Test) ? engine->TestContext->Test : nullptr; + + ImOsConsoleSetTextColor(ImOsConsoleStream_StandardError, ImOsConsoleTextColor_BrightRed); + if (crashed_test != nullptr) + fprintf(stderr, "**ImGuiTestEngine_CrashHandler()** Crashed while running \"%s\" :(\n", crashed_test->Name); + else + fprintf(stderr, "**ImGuiTestEngine_CrashHandler()** Crashed :(\n"); + static bool handled = false; if (handled) return; handled = true; - ImGuiContext& g = *GImGui; - ImGuiTestEngine* engine = (ImGuiTestEngine*)g.TestEngine; - // Write stop times, because thread executing tests will no longer run. engine->BatchEndTime = ImTimeGetInMicroseconds(); - for (int i = 0; i < engine->TestsAll.Size; i++) + if (crashed_test && crashed_test->Output.Status == ImGuiTestStatus_Running) { - if (engine->TestContext) - if (ImGuiTest* test = engine->TestContext->Test) - if (test->Output.Status == ImGuiTestStatus_Running) - { - test->Output.Status = ImGuiTestStatus_Error; - test->Output.EndTime = engine->BatchEndTime; - break; - } + crashed_test->Output.Status = ImGuiTestStatus_Error; + crashed_test->Output.EndTime = engine->BatchEndTime; } // Export test run results. ImGuiTestEngine_Export(engine); + ImGuiTestEngine_PrintResultSummary(engine); } #ifdef _WIN32 @@ -2044,7 +2078,7 @@ void ImGuiTestEngine_InstallDefaultCrashHandler() { #ifdef _WIN32 SetUnhandledExceptionFilter(&ImGuiTestEngine_CrashHandlerWin32); -#else +#elif !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE // Install a crash handler to relevant signals. struct sigaction action = {}; action.sa_handler = ImGuiTestEngine_CrashHandlerUnix; diff --git a/libs/imgui_test_engine/imgui_te_engine.h b/libs/imgui_test_engine/imgui_te_engine.h index 5467339..0c0a077 100644 --- a/libs/imgui_test_engine/imgui_te_engine.h +++ b/libs/imgui_test_engine/imgui_te_engine.h @@ -3,6 +3,9 @@ // This is the interface that your initial setup (app init, main loop) will mostly be using. // Actual tests will mostly use the interface of imgui_te_context.h +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once #include "imgui.h" @@ -40,6 +43,7 @@ struct ImGuiTestContext; // Context while a test is running struct ImGuiTestCoroutineInterface; // Interface to expose coroutine functions (imgui_te_coroutine provides a default implementation for C++11 using std::thread, but you may use your own) struct ImGuiTestEngine; // Test engine instance struct ImGuiTestEngineIO; // Test engine public I/O +struct ImGuiTestEngineResultSummary;// Output of ImGuiTestEngine_GetResultSummary() struct ImGuiTestItemInfo; // Info queried from item (id, geometry, status flags, debug label) struct ImGuiTestItemList; // A list of items struct ImGuiTestInputs; // Simulated user inputs (will be fed into ImGuiIO by the test engine) @@ -150,6 +154,13 @@ enum ImGuiTestRunFlags_ // TODO: Add GuiFunc options }; +struct ImGuiTestEngineResultSummary +{ + int CountTested = 0; // Number of tests executed + int CountSuccess = 0; // Number of tests succeeded + int CountInQueue = 0; // Number of tests remaining in queue (e.g. aborted, crashed) +}; + //------------------------------------------------------------------------- // Functions //------------------------------------------------------------------------- @@ -203,10 +214,15 @@ IMGUI_API ImGuiTest* ImGuiTestEngine_FindTestByName(ImGuiTestEngine* en // FIXME: Clarify API to avoid function calls vs raw bools in ImGuiTestEngineIO IMGUI_API bool ImGuiTestEngine_IsTestQueueEmpty(ImGuiTestEngine* engine); IMGUI_API bool ImGuiTestEngine_IsUsingSimulatedInputs(ImGuiTestEngine* engine); -IMGUI_API void ImGuiTestEngine_GetResult(ImGuiTestEngine* engine, int& count_tested, int& success_count); +IMGUI_API void ImGuiTestEngine_GetResultSummary(ImGuiTestEngine* engine, ImGuiTestEngineResultSummary* out_results); IMGUI_API void ImGuiTestEngine_GetTestList(ImGuiTestEngine* engine, ImVector* out_tests); IMGUI_API void ImGuiTestEngine_GetTestQueue(ImGuiTestEngine* engine, ImVector* out_tests); +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +// Obsoleted 2025/03/17 +static inline void ImGuiTestEngine_GetResult(ImGuiTestEngine* engine, int& out_count_tested, int& out_count_success) { ImGuiTestEngineResultSummary summary; ImGuiTestEngine_GetResultSummary(engine, &summary); out_count_tested = summary.CountTested; out_count_success = summary.CountSuccess; } +#endif + // Functions: Crash Handling // Ensure past test results are properly exported even if application crash during a test. IMGUI_API void ImGuiTestEngine_InstallDefaultCrashHandler(); // Install default crash handler (if you don't have one) diff --git a/libs/imgui_test_engine/imgui_te_exporters.cpp b/libs/imgui_test_engine/imgui_te_exporters.cpp index 377f333..03a3cee 100644 --- a/libs/imgui_test_engine/imgui_te_exporters.cpp +++ b/libs/imgui_test_engine/imgui_te_exporters.cpp @@ -2,6 +2,9 @@ // (result exporters) // Read https://github.com/ocornut/imgui_test_engine/wiki/Exporting-Results +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif @@ -27,11 +30,10 @@ static void ImGuiTestEngine_ExportJUnitXml(ImGuiTestEngine* engine, const char* void ImGuiTestEngine_PrintResultSummary(ImGuiTestEngine* engine) { - int count_tested = 0; - int count_success = 0; - ImGuiTestEngine_GetResult(engine, count_tested, count_success); + ImGuiTestEngineResultSummary summary; + ImGuiTestEngine_GetResultSummary(engine, &summary); - if (count_success < count_tested) + if (summary.CountSuccess < summary.CountTested) { printf("\nFailing tests:\n"); for (ImGuiTest* test : engine->TestsAll) @@ -39,9 +41,12 @@ void ImGuiTestEngine_PrintResultSummary(ImGuiTestEngine* engine) printf("- %s\n", test->Name); } - ImOsConsoleSetTextColor(ImOsConsoleStream_StandardOutput, (count_success == count_tested) ? ImOsConsoleTextColor_BrightGreen : ImOsConsoleTextColor_BrightRed); - printf("\nTests Result: %s\n", (count_success == count_tested) ? "OK" : "Errors"); - printf("(%d/%d tests passed)\n", count_success, count_tested); + bool success = (summary.CountSuccess == summary.CountTested); + ImOsConsoleSetTextColor(ImOsConsoleStream_StandardOutput, success ? ImOsConsoleTextColor_BrightGreen : ImOsConsoleTextColor_BrightRed); + printf("\nTests Result: %s\n", success ? "OK" : "Errors"); + printf("(%d/%d tests passed)\n", summary.CountSuccess, summary.CountTested); + if (summary.CountInQueue > 0) + printf("(%d queued tests remaining)\n", summary.CountInQueue); ImOsConsoleSetTextColor(ImOsConsoleStream_StandardOutput, ImOsConsoleTextColor_White); } diff --git a/libs/imgui_test_engine/imgui_te_exporters.h b/libs/imgui_test_engine/imgui_te_exporters.h index 49392a8..375d3c6 100644 --- a/libs/imgui_test_engine/imgui_te_exporters.h +++ b/libs/imgui_test_engine/imgui_te_exporters.h @@ -2,6 +2,9 @@ // (result exporters) // Read https://github.com/ocornut/imgui_test_engine/wiki/Exporting-Results +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once //------------------------------------------------------------------------- diff --git a/libs/imgui_test_engine/imgui_te_imconfig.h b/libs/imgui_test_engine/imgui_te_imconfig.h index e68b7d9..aa4ddfa 100644 --- a/libs/imgui_test_engine/imgui_te_imconfig.h +++ b/libs/imgui_test_engine/imgui_te_imconfig.h @@ -28,6 +28,16 @@ #define IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL 0 #endif +// [Optional, default 0] Disable calls that do not make sense on game consoles +// (Disable: system(), popen(), sigaction(), colored TTY output) +#ifndef IMGUI_TEST_ENGINE_IS_GAME_CONSOLE +#if defined(__ORBIS__) || defined(__PROSPERO__) || defined(_GAMING_XBOX) || defined(_DURANGO) +#define IMGUI_TEST_ENGINE_IS_GAME_CONSOLE 1 +#else +#define IMGUI_TEST_ENGINE_IS_GAME_CONSOLE 0 +#endif +#endif + // Define IM_DEBUG_BREAK macros so it is accessible in imgui.h // (this is a conveniance for app using test engine may define an IM_ASSERT() that uses this instead of an actual assert) // (this is a copy of the block in imgui_internal.h. if the one in imgui_internal.h were to be defined at the top of imgui.h we wouldn't need this) diff --git a/libs/imgui_test_engine/imgui_te_internal.h b/libs/imgui_test_engine/imgui_te_internal.h index 33b60ef..b854342 100644 --- a/libs/imgui_test_engine/imgui_te_internal.h +++ b/libs/imgui_test_engine/imgui_te_internal.h @@ -1,6 +1,9 @@ // dear imgui test engine // (internal api) +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once #include "imgui_te_coroutine.h" diff --git a/libs/imgui_test_engine/imgui_te_perftool.cpp b/libs/imgui_test_engine/imgui_te_perftool.cpp index 831203d..6ebb4d8 100644 --- a/libs/imgui_test_engine/imgui_te_perftool.cpp +++ b/libs/imgui_test_engine/imgui_te_perftool.cpp @@ -3,6 +3,9 @@ // Browse and visualize samples recorded by ctx->PerfCapture() calls. // User access via 'Test Engine UI -> Tools -> Perf Tool' +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + /* Index of this file: @@ -1795,7 +1798,7 @@ void ImGuiPerfTool::_UnpackSortedKey(ImU64 key, int* batch_index, int* entry_ind static bool SetPerfToolWindowOpen(ImGuiTestContext* ctx, bool is_open) { ctx->MenuClick("//Dear ImGui Test Engine/Tools"); - bool was_open = ctx->ItemIsChecked("//##Menu_00/Perf Tool"); + bool was_open = ctx->ItemIsChecked("//$FOCUSED/Perf Tool"); ctx->MenuAction(is_open ? ImGuiTestAction_Check : ImGuiTestAction_Uncheck, "//Dear ImGui Test Engine/Tools/Perf Tool"); return was_open; } @@ -1944,7 +1947,11 @@ void RegisterTests_TestEnginePerfTool(ImGuiTestEngine* e) ImGui::SetWindowSize(window, size_bkp); SetPerfToolWindowOpen(ctx, perf_was_open); // Restore window visibility +#if !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE const char* perf_report_output = getenv("CAPTURE_PERF_REPORT_OUTPUT"); +#else + const char* perf_report_output = nullptr; +#endif if (perf_report_output == nullptr) perf_report_output = PerfToolReportDefaultOutputPath; perftool->SaveHtmlReport(perf_report_output, perf_report_image); diff --git a/libs/imgui_test_engine/imgui_te_perftool.h b/libs/imgui_test_engine/imgui_te_perftool.h index 1c9a419..4936068 100644 --- a/libs/imgui_test_engine/imgui_te_perftool.h +++ b/libs/imgui_test_engine/imgui_te_perftool.h @@ -3,6 +3,9 @@ // Browse and visualize samples recorded by ctx->PerfCapture() calls. // User access via 'Test Engine UI -> Tools -> Perf Tool' +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once #include "imgui.h" diff --git a/libs/imgui_test_engine/imgui_te_ui.cpp b/libs/imgui_test_engine/imgui_te_ui.cpp index b538784..fdde871 100644 --- a/libs/imgui_test_engine/imgui_te_ui.cpp +++ b/libs/imgui_test_engine/imgui_te_ui.cpp @@ -2,6 +2,9 @@ // (ui) // If you run tests in an interactive or visible application, you may want to call ImGuiTestEngine_ShowTestEngineWindows() +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif diff --git a/libs/imgui_test_engine/imgui_te_ui.h b/libs/imgui_test_engine/imgui_te_ui.h index ce93381..88de8ff 100644 --- a/libs/imgui_test_engine/imgui_te_ui.h +++ b/libs/imgui_test_engine/imgui_te_ui.h @@ -2,6 +2,9 @@ // (ui) // If you run tests in an interactive or visible application, you may want to call ImGuiTestEngine_ShowTestEngineWindows() +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + // Provide access to: // - "Dear ImGui Test Engine" main interface // - "Dear ImGui Capture Tool" diff --git a/libs/imgui_test_engine/imgui_te_utils.cpp b/libs/imgui_test_engine/imgui_te_utils.cpp index 5afe1ea..1b4910f 100644 --- a/libs/imgui_test_engine/imgui_te_utils.cpp +++ b/libs/imgui_test_engine/imgui_te_utils.cpp @@ -1,6 +1,9 @@ // dear imgui test engine // (helpers/utilities. do NOT use this as a general purpose library) +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif @@ -837,6 +840,8 @@ const ImBuildInfo* ImBuildGetCompilationInfo() build_info.OS = "OSX"; #elif defined(__ORBIS__) build_info.OS = "PS4"; +#elif defined(__PROSPERO__) + build_info.OS = "PS5"; #elif defined(_DURANGO) build_info.OS = "XboxOne"; #else @@ -903,7 +908,7 @@ bool ImBuildFindGitBranchName(const char* git_repo_path, Str* branch_name) bool ImOsCreateProcess(const char* cmd_line) { -#ifdef _WIN32 +#if defined(_WIN32) && !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE STARTUPINFOA siStartInfo; PROCESS_INFORMATION piProcInfo; ZeroMemory(&siStartInfo, sizeof(STARTUPINFOA)); @@ -918,6 +923,7 @@ bool ImOsCreateProcess(const char* cmd_line) return ret != 0; #else IM_UNUSED(cmd_line); + IM_ASSERT(0); return false; #endif } @@ -926,7 +932,7 @@ FILE* ImOsPOpen(const char* cmd_line, const char* mode) { IM_ASSERT(cmd_line != nullptr && *cmd_line); IM_ASSERT(mode != nullptr && *mode); -#if _WIN32 +#if defined(_WIN32) && !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE ImVector w_cmd_line; ImVector w_mode; ImUtf8ToWideChar(cmd_line, &w_cmd_line); @@ -934,28 +940,33 @@ FILE* ImOsPOpen(const char* cmd_line, const char* mode) w_mode.resize(w_mode.Size + 1); wcscat(w_mode.Data, L"b"); // Windows requires 'b' mode while unixes do not support it and default to binary. return _wpopen(w_cmd_line.Data, w_mode.Data); -#else +#elif !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE return popen(cmd_line, mode); +#else + IM_ASSERT(0); + return NULL; #endif } void ImOsPClose(FILE* fp) { IM_ASSERT(fp != nullptr); -#if _WIN32 +#if defined(_WIN32) && !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE _pclose(fp); -#else +#elif !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE pclose(fp); +#else + IM_ASSERT(0); #endif } void ImOsOpenInShell(const char* path) { Str256 command(path); -#ifdef _WIN32 +#if defined(_WIN32) && !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE ImPathFixSeparatorsForCurrentOS(command.c_str()); ::ShellExecuteA(nullptr, "open", command.c_str(), nullptr, nullptr, SW_SHOWDEFAULT); -#else +#elif !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE #if __APPLE__ const char* open_executable = "open"; #else @@ -964,12 +975,15 @@ void ImOsOpenInShell(const char* path) command.setf("%s \"%s\"", open_executable, path); ImPathFixSeparatorsForCurrentOS(command.c_str()); system(command.c_str()); +#else + IM_UNUSED(path); + IM_ASSERT(0); #endif } void ImOsConsoleSetTextColor(ImOsConsoleStream stream, ImOsConsoleTextColor color) { -#ifdef _WIN32 +#if defined(_WIN32) && !IMGUI_TEST_ENGINE_IS_GAME_CONSOLE HANDLE hConsole = 0; switch (stream) { @@ -1012,6 +1026,9 @@ void ImOsConsoleSetTextColor(ImOsConsoleStream stream, ImOsConsoleTextColor c } fprintf(handle, "%s", modifier); +#else + IM_UNUSED(stream); + IM_UNUSED(color); #endif } @@ -1206,7 +1223,13 @@ ImFont* ImGui::FindFontByPrefix(const char* prefix) { ImGuiContext& g = *GImGui; for (ImFont* font : g.IO.Fonts->Fonts) +#if IMGUI_VERSION_NUM < 19184 if (strncmp(font->ConfigData->Name, prefix, strlen(prefix)) == 0) +#elif defined(IMGUI_HAS_TEXTURES) + if (strncmp(font->Sources[0]->Name, prefix, strlen(prefix)) == 0) +#else + if (strncmp(font->Sources[0].Name, prefix, strlen(prefix)) == 0) +#endif return font; return nullptr; } diff --git a/libs/imgui_test_engine/imgui_te_utils.h b/libs/imgui_test_engine/imgui_te_utils.h index 9e797ac..c964f66 100644 --- a/libs/imgui_test_engine/imgui_te_utils.h +++ b/libs/imgui_test_engine/imgui_te_utils.h @@ -1,6 +1,9 @@ // dear imgui test engine // (helpers/utilities. do NOT use this as a general purpose library) +// This file is governed by the "Dear ImGui Test Engine License". +// Details of the license are provided in the LICENSE.txt file in the same directory. + #pragma once //----------------------------------------------------------------------------- diff --git a/libs/imgui_test_engine/thirdparty/Str/.editorconfig b/libs/imgui_test_engine/thirdparty/Str/.editorconfig new file mode 100644 index 0000000..7202451 --- /dev/null +++ b/libs/imgui_test_engine/thirdparty/Str/.editorconfig @@ -0,0 +1,5 @@ +[*.{h,cpp}] +indent_style = space +indent_size = 4 + + diff --git a/libs/imgui_test_engine/thirdparty/Str/Str.natvis b/libs/imgui_test_engine/thirdparty/Str/Str.natvis new file mode 100644 index 0000000..e20ea6a --- /dev/null +++ b/libs/imgui_test_engine/thirdparty/Str/Str.natvis @@ -0,0 +1,14 @@ + + + + + + { Data, na } + + Data, na + strlen(Data) + Capacity + + + + \ No newline at end of file diff --git a/src/backend_dx12.zig b/src/backend_dx12.zig index 88c124f..ff5a159 100644 --- a/src/backend_dx12.zig +++ b/src/backend_dx12.zig @@ -18,12 +18,12 @@ pub const ImGui_ImplDX12_InitInfo = extern struct { *ImGui_ImplDX12_InitInfo, *D3D12_CPU_DESCRIPTOR_HANDLE, *D3D12_GPU_DESCRIPTOR_HANDLE, - ) callconv(.C) void = null, + ) callconv(.c) void = null, srv_desc_free_fn: ?*const fn ( *ImGui_ImplDX12_InitInfo, D3D12_CPU_DESCRIPTOR_HANDLE, D3D12_GPU_DESCRIPTOR_HANDLE, - ) callconv(.C) void = null, + ) callconv(.c) void = null, font_srv_cpu_desc_handle: D3D12_CPU_DESCRIPTOR_HANDLE, font_srv_gpu_desc_handle: D3D12_GPU_DESCRIPTOR_HANDLE, }; diff --git a/src/backend_glfw_vulkan.zig b/src/backend_glfw_vulkan.zig index 8589764..cbcdd27 100644 --- a/src/backend_glfw_vulkan.zig +++ b/src/backend_glfw_vulkan.zig @@ -12,7 +12,7 @@ pub fn init(init_info: ImGui_ImplVulkan_InitInfo, window: *const anyopaque) void } pub fn loadFunctions( - loader: fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.C) ?*anyopaque, + loader: fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.c) ?*anyopaque, user_data: ?*anyopaque, ) bool { return backend_vulkan.loadFunctions(loader, user_data); diff --git a/src/backend_vulkan.zig b/src/backend_vulkan.zig index 210425d..c2962a3 100644 --- a/src/backend_vulkan.zig +++ b/src/backend_vulkan.zig @@ -33,7 +33,7 @@ pub const ImGui_ImplVulkan_InitInfo = extern struct { pipeline_rendering_create_info: VkPipelineRenderingCreateInfo = .{}, allocator: ?*const anyopaque = null, - check_vk_result_fn: ?*const fn (err: u32) callconv(.C) void = null, + check_vk_result_fn: ?*const fn (err: u32) callconv(.c) void = null, min_allocation_size: u64 = 0, }; @@ -46,7 +46,7 @@ pub fn init(init_info: ImGui_ImplVulkan_InitInfo) void { } pub fn loadFunctions( - loader: fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.C) ?*anyopaque, + loader: fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.c) ?*anyopaque, user_data: ?*anyopaque, ) bool { return ImGui_ImplVulkan_LoadFunctions(loader, user_data); @@ -86,6 +86,6 @@ extern fn ImGui_ImplVulkan_CreateFontsTexture() void; extern fn ImGui_ImplVulkan_DestroyFontsTexture() void; extern fn ImGui_ImplVulkan_SetMinImageCount(min_image_count: u32) void; extern fn ImGui_ImplVulkan_LoadFunctions( - loader_func: *const fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.C) ?*anyopaque, + loader_func: *const fn (function_name: [*:0]const u8, user_data: ?*anyopaque) callconv(.c) ?*anyopaque, user_data: ?*anyopaque, ) bool; diff --git a/src/gui.zig b/src/gui.zig index 8584a27..850f6c7 100644 --- a/src/gui.zig +++ b/src/gui.zig @@ -3695,12 +3695,12 @@ var temp_buffer: ?std.ArrayList(u8) = null; pub fn format(comptime fmt: []const u8, args: anytype) []const u8 { const len = std.fmt.count(fmt, args); - if (len > temp_buffer.?.items.len) temp_buffer.?.resize(@intCast(len + 64)) catch unreachable; + if (len > temp_buffer.?.items.len) temp_buffer.?.resize(mem_allocator.?, @intCast(len + 64)) catch unreachable; return std.fmt.bufPrint(temp_buffer.?.items, fmt, args) catch unreachable; } pub fn formatZ(comptime fmt: []const u8, args: anytype) [:0]const u8 { const len = std.fmt.count(fmt ++ "\x00", args); - if (len > temp_buffer.?.items.len) temp_buffer.?.resize(@intCast(len + 64)) catch unreachable; + if (len > temp_buffer.?.items.len) temp_buffer.?.resize(mem_allocator.?, @intCast(len + 64)) catch unreachable; return std.fmt.bufPrintZ(temp_buffer.?.items, fmt, args) catch unreachable; } //-------------------------------------------------------------------------------------------------- @@ -4031,7 +4031,7 @@ pub fn beginDragDropSource(flags: DragDropFlags) bool { /// Note: `payload_type` can be at most 32 characters long pub fn setDragDropPayload(payload_type: [*:0]const u8, data: []const u8, cond: Condition) bool { - return zguiSetDragDropPayload(payload_type, @alignCast(@ptrCast(data.ptr)), data.len, cond); + return zguiSetDragDropPayload(payload_type, @ptrCast(@alignCast(data.ptr)), data.len, cond); } pub fn endDragDropSource() void { zguiEndDragDropSource(); @@ -4238,8 +4238,8 @@ pub const DrawList = *opaque { pub const popClipRect = zguiDrawList_PopClipRect; extern fn zguiDrawList_PopClipRect(draw_list: DrawList) void; //---------------------------------------------------------------------------------------------- - pub const pushTexture = zguiDrawList_PushTexture; - extern fn zguiDrawList_PushTexture(draw_list: DrawList, texture_ref: TextureRef) void; + pub const pushTexture = zguiDrawList_PushTextureRef; + extern fn zguiDrawList_PushTextureRef(draw_list: DrawList, texture_ref: TextureRef) void; pub const popTexture = zguiDrawList_PopTexture; extern fn zguiDrawList_PopTexture(draw_list: DrawList) void; diff --git a/src/node_editor.zig b/src/node_editor.zig index b6d2757..ac2e40f 100644 --- a/src/node_editor.zig +++ b/src/node_editor.zig @@ -111,11 +111,11 @@ const CanvasSizeMode = enum(c_int) { CenterOnly, // Previous view will be centered on new view }; -const SaveNodeSettings = fn (nodeId: NodeId, data: [*]const u8, size: usize, reason: SaveReasonFlags, userPointer: *anyopaque) callconv(.C) bool; -const LoadNodeSettings = fn (nodeId: NodeId, data: [*]u8, userPointer: *anyopaque) callconv(.C) usize; -const SaveSettings = fn (data: [*]const u8, size: usize, reason: SaveReasonFlags, userPointer: *anyopaque) callconv(.C) bool; -const LoadSettings = fn (data: [*]u8, userPointer: *anyopaque) callconv(.C) usize; -const ConfigSession = fn (userPointer: *anyopaque) callconv(.C) void; +const SaveNodeSettings = fn (nodeId: NodeId, data: [*]const u8, size: usize, reason: SaveReasonFlags, userPointer: *anyopaque) callconv(.c) bool; +const LoadNodeSettings = fn (nodeId: NodeId, data: [*]u8, userPointer: *anyopaque) callconv(.c) usize; +const SaveSettings = fn (data: [*]const u8, size: usize, reason: SaveReasonFlags, userPointer: *anyopaque) callconv(.c) bool; +const LoadSettings = fn (data: [*]u8, userPointer: *anyopaque) callconv(.c) usize; +const ConfigSession = fn (userPointer: *anyopaque) callconv(.c) void; const _ImVector = extern struct { Size: c_int = 0, diff --git a/src/te.zig b/src/te.zig index efd1eab..27e47d9 100644 --- a/src/te.zig +++ b/src/te.zig @@ -97,7 +97,7 @@ pub const TestEngine = opaque { @intCast(src.line), if (std.meta.hasFn(Callbacks, "gui")) struct { - fn f(context: *TestContext) callconv(.C) void { + fn f(context: *TestContext) callconv(.c) void { Callbacks.gui(context) catch undefined; } }.f @@ -105,7 +105,7 @@ pub const TestEngine = opaque { null, if (std.meta.hasFn(Callbacks, "run")) struct { - fn f(context: *TestContext) callconv(.C) void { + fn f(context: *TestContext) callconv(.c) void { Callbacks.run(context) catch undefined; } }.f @@ -207,8 +207,8 @@ pub const TestContext = opaque { extern fn zguiTe_ContextKeyUp(ctx: *TestContext, key_chord: c_int) void; }; -const ImGuiTestGuiFunc = fn (context: *TestContext) callconv(.C) void; -const ImGuiTestTestFunc = fn (context: *TestContext) callconv(.C) void; +const ImGuiTestGuiFunc = fn (context: *TestContext) callconv(.c) void; +const ImGuiTestTestFunc = fn (context: *TestContext) callconv(.c) void; pub const createContext = zguiTe_CreateContext; extern fn zguiTe_CreateContext() *TestEngine; diff --git a/src/zgui.cpp b/src/zgui.cpp index 73b318d..5ac98e4 100644 --- a/src/zgui.cpp +++ b/src/zgui.cpp @@ -1090,7 +1090,7 @@ extern "C" } ZGUI_API void zguiImage( - ImTextureID user_texture_id, + ImTextureRef user_texture_id, float w, float h, const float uv0[2], @@ -1104,7 +1104,7 @@ extern "C" } ZGUI_API void zguiImageWithBg( - ImTextureID user_texture_id, + ImTextureRef user_texture_id, float w, float h, const float uv0[2], @@ -1123,7 +1123,7 @@ extern "C" ZGUI_API bool zguiImageButton( const char *str_id, - ImTextureID user_texture_id, + ImTextureRef user_texture_id, float w, float h, const float uv0[2], diff --git a/src/zte.cpp b/src/zte.cpp index 05f6f12..078c615 100644 --- a/src/zte.cpp +++ b/src/zte.cpp @@ -67,11 +67,11 @@ extern "C" ZGUI_API void zguiTe_GetResult(ImGuiTestEngine *engine, int *count_tested, int *count_success) { - int ct = 0; - int cs = 0; - ImGuiTestEngine_GetResult(engine, ct, cs); - *count_tested = ct; - *count_success = cs; + + ImGuiTestEngineResultSummary summary; + ImGuiTestEngine_GetResultSummary(engine, &summary); + *count_tested = summary.CountTested; + *count_success = summary.CountSuccess; } ZGUI_API void zguiTe_PrintResultSummary(ImGuiTestEngine *engine)