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>
80 lines
2.9 KiB
C++
80 lines
2.9 KiB
C++
#pragma once
|
|
// qa_state.h — estado compartido entre tabs + panel QA + perf/test suites.
|
|
//
|
|
// Centraliza:
|
|
// - QaToggles: feature flags activables por checkbox.
|
|
// - QaCounters: counters live emulando data_table::internal::* (TBD modulo v2.2.0).
|
|
// - TabState: backing storage por tab + data_table::State persistente.
|
|
//
|
|
// Una sola instancia global por proceso. Acceso via accessors definidos en
|
|
// qa_state.cpp para evitar duplicate symbol entre TUs.
|
|
|
|
#include "data_table/data_table.h"
|
|
#include "core/data_table_types.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace qa {
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Toggles globales. Apps reales mutan ColumnSpec en runtime con el mismo patron.
|
|
// ---------------------------------------------------------------------------
|
|
struct QaToggles {
|
|
bool show_chrome = true;
|
|
bool enable_buttons = true;
|
|
bool enable_color_scale = true;
|
|
bool enable_categorical = true;
|
|
bool enable_badges = true;
|
|
bool enable_duration = true;
|
|
bool enable_dots = true;
|
|
bool enable_icon = false;
|
|
bool enable_tooltip = true;
|
|
bool enable_row_dblclick = true;
|
|
bool enable_row_rightclick = false;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Counters live. Cada vez que un TabEvent pasa por consume_events() se incrementan.
|
|
// ---------------------------------------------------------------------------
|
|
struct QaCounters {
|
|
int button_clicks = 0;
|
|
int row_double_click = 0;
|
|
int row_right_click = 0;
|
|
int frames_rendered = 0;
|
|
// Perf
|
|
long long last_perf_rows = 0;
|
|
double last_perf_seed_ms = 0.0;
|
|
double last_perf_render_ms_p50 = 0.0;
|
|
double last_perf_render_ms_p95 = 0.0;
|
|
int last_perf_frames = 0;
|
|
// Test suite
|
|
int last_test_total = 0;
|
|
int last_test_passed = 0;
|
|
int last_test_failed = 0;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// TabState — backing storage + data_table::State por tab.
|
|
// ---------------------------------------------------------------------------
|
|
struct TabState {
|
|
std::vector<std::string> back;
|
|
std::vector<const char*> ptrs;
|
|
data_table::State dt;
|
|
std::vector<data_table::TableEvent> last_events;
|
|
};
|
|
|
|
// Refill ptrs[] desde back[]. Llamar tras cada cambio.
|
|
void rebuild_ptrs(TabState& s);
|
|
|
|
// Consume events emitidos por render(): incrementa counters globales.
|
|
void consume_events(const std::vector<data_table::TableEvent>& events);
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Singletons (definidos en qa_state.cpp).
|
|
// ---------------------------------------------------------------------------
|
|
QaToggles& toggles();
|
|
QaCounters& counters();
|
|
|
|
} // namespace qa
|