b15106fc09
- CMakeLists.txt - app.md - appicon.ico - main.cpp - perf_tests.cpp - perf_tests.h - qa_panel.cpp - qa_panel.h - qa_state.cpp - qa_state.h - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
137 lines
5.1 KiB
C++
137 lines
5.1 KiB
C++
// qa_panel — implementacion del panel QA flotante.
|
|
#include "qa_panel.h"
|
|
#include "qa_state.h"
|
|
#include "test_suite.h"
|
|
#include "perf_tests.h"
|
|
#include "core/icons_tabler.h"
|
|
|
|
#include <imgui.h>
|
|
|
|
namespace tables_qa {
|
|
|
|
void render_qa_menu_item(bool* open) {
|
|
ImGui::MenuItem(TI_SETTINGS " QA Panel", nullptr, open);
|
|
}
|
|
|
|
void render_qa_panel(bool* open) {
|
|
if (!*open) return;
|
|
|
|
ImGui::SetNextWindowSize(ImVec2(900, 280), ImGuiCond_FirstUseEver);
|
|
if (!ImGui::Begin(TI_FLASK " QA Control Panel", open,
|
|
ImGuiWindowFlags_NoCollapse)) {
|
|
ImGui::End();
|
|
return;
|
|
}
|
|
|
|
auto& t = qa::toggles();
|
|
auto& c = qa::counters();
|
|
|
|
// --- Section: Counters live ---
|
|
ImGui::TextColored(ImVec4(0.6f, 0.7f, 1.0f, 1.0f),
|
|
TI_ACTIVITY " Counters live");
|
|
ImGui::Separator();
|
|
ImGui::BeginTable("##counters_tbl", 4, ImGuiTableFlags_SizingStretchSame);
|
|
ImGui::TableNextColumn(); ImGui::Text("button_clicks");
|
|
ImGui::TableNextColumn(); ImGui::Text("%d", c.button_clicks);
|
|
ImGui::TableNextColumn(); ImGui::Text("row_double_click");
|
|
ImGui::TableNextColumn(); ImGui::Text("%d", c.row_double_click);
|
|
ImGui::TableNextColumn(); ImGui::Text("row_right_click");
|
|
ImGui::TableNextColumn(); ImGui::Text("%d", c.row_right_click);
|
|
ImGui::TableNextColumn(); ImGui::Text("frames_rendered");
|
|
ImGui::TableNextColumn(); ImGui::Text("%d", c.frames_rendered);
|
|
ImGui::EndTable();
|
|
if (ImGui::Button(TI_REFRESH " Reset counters")) {
|
|
c.button_clicks = c.row_double_click = c.row_right_click = c.frames_rendered = 0;
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
// --- Section: Toggles ---
|
|
ImGui::TextColored(ImVec4(0.6f, 0.7f, 1.0f, 1.0f),
|
|
TI_SETTINGS " Feature toggles");
|
|
ImGui::Separator();
|
|
ImGui::Checkbox("show_chrome", &t.show_chrome);
|
|
ImGui::SameLine(); ImGui::Checkbox("buttons", &t.enable_buttons);
|
|
ImGui::SameLine(); ImGui::Checkbox("badges", &t.enable_badges);
|
|
ImGui::SameLine(); ImGui::Checkbox("colorscale", &t.enable_color_scale);
|
|
ImGui::Checkbox("categorical", &t.enable_categorical);
|
|
ImGui::SameLine(); ImGui::Checkbox("duration", &t.enable_duration);
|
|
ImGui::SameLine(); ImGui::Checkbox("dots", &t.enable_dots);
|
|
ImGui::SameLine(); ImGui::Checkbox("icon", &t.enable_icon);
|
|
ImGui::Checkbox("tooltip", &t.enable_tooltip);
|
|
ImGui::SameLine(); ImGui::Checkbox("row_dblclick", &t.enable_row_dblclick);
|
|
ImGui::SameLine(); ImGui::Checkbox("row_rmb", &t.enable_row_rightclick);
|
|
|
|
ImGui::Spacing();
|
|
|
|
// --- Section: Module version + actions ---
|
|
ImGui::TextColored(ImVec4(0.6f, 0.7f, 1.0f, 1.0f),
|
|
TI_GIT_BRANCH " Module data_table");
|
|
ImGui::Separator();
|
|
ImGui::Text("Active version:");
|
|
ImGui::SameLine();
|
|
ImGui::TextColored(ImVec4(0.7f, 0.7f, 1.0f, 1.0f), "2.1.0");
|
|
ImGui::SameLine(); ImGui::Dummy(ImVec2(20, 0)); ImGui::SameLine();
|
|
ImGui::TextDisabled("[compat downgrade selector: TBD fase 2]");
|
|
|
|
ImGui::Spacing();
|
|
|
|
// --- Section: Actions — Test + Perf ---
|
|
ImGui::TextColored(ImVec4(0.6f, 0.7f, 1.0f, 1.0f),
|
|
TI_PLAYER_PLAY " Actions");
|
|
ImGui::Separator();
|
|
|
|
if (ImGui::Button(TI_CHECK " Run Tests", ImVec2(180, 32))) {
|
|
tables_qa::run_test_suite();
|
|
}
|
|
ImGui::SameLine();
|
|
if (c.last_test_total > 0) {
|
|
ImVec4 col = (c.last_test_failed == 0)
|
|
? ImVec4(0.4f, 0.9f, 0.4f, 1.0f) : ImVec4(0.9f, 0.4f, 0.4f, 1.0f);
|
|
ImGui::TextColored(col, " Tests: %d/%d pass (%d failed)",
|
|
c.last_test_passed, c.last_test_total, c.last_test_failed);
|
|
} else {
|
|
ImGui::TextDisabled(" (no tests run yet)");
|
|
}
|
|
|
|
ImGui::Spacing();
|
|
|
|
if (ImGui::Button(TI_GAUGE " Performance Tests", ImVec2(180, 32))) {
|
|
ImGui::OpenPopup("##perf_popup");
|
|
}
|
|
ImGui::SameLine();
|
|
if (c.last_perf_rows > 0) {
|
|
ImGui::Text(" Last: %lld rows seed=%.1fms p50=%.2fms p95=%.2fms (%d frames)",
|
|
c.last_perf_rows, c.last_perf_seed_ms,
|
|
c.last_perf_render_ms_p50, c.last_perf_render_ms_p95,
|
|
c.last_perf_frames);
|
|
} else {
|
|
ImGui::TextDisabled(" (no perf run yet)");
|
|
}
|
|
|
|
// Popup de configuracion de perf test
|
|
if (ImGui::BeginPopup("##perf_popup")) {
|
|
static int rows_pow = 6; // 10^6 = 1M default
|
|
static int frames_to_measure = 60;
|
|
ImGui::Text("Stress test data_table::render with N rows.");
|
|
ImGui::Separator();
|
|
ImGui::SliderInt("rows (10^N)", &rows_pow, 3, 7); // 1K..10M
|
|
ImGui::SliderInt("frames", &frames_to_measure, 30, 300);
|
|
long long rows = 1;
|
|
for (int i = 0; i < rows_pow; ++i) rows *= 10;
|
|
ImGui::Text("Target: %lld rows, %d frames measured", rows, frames_to_measure);
|
|
|
|
if (ImGui::Button(TI_PLAYER_PLAY " Run perf")) {
|
|
tables_qa::run_perf_test(rows, frames_to_measure);
|
|
ImGui::CloseCurrentPopup();
|
|
}
|
|
ImGui::SameLine();
|
|
if (ImGui::Button("Cancel")) ImGui::CloseCurrentPopup();
|
|
ImGui::EndPopup();
|
|
}
|
|
|
|
ImGui::End();
|
|
}
|
|
|
|
} // namespace tables_qa
|