data_table: declarative cell renderers Phase 1 (Badge/Progress/Duration/Icon)
Adds TableInput.column_specs sidecar field enabling apps to declare Badge,
Progress, Duration and Icon renderers per column without writing ImGui inline.
Back-compat: apps without column_specs compile and behave identically.
- data_table_types.h: CellRenderer enum, BadgeRule, IconMapEntry, ColumnSpec types
- data_table.cpp: hex_to_imcolor helper, icon_name_to_glyph static map (~30 Tabler icons),
draw_cell_custom dispatcher, integration in Stage-0 and Stage-N cell loops and draw_extra_panel
- Bump version 1.0.0 -> 1.1.0 with capability growth log
- cpp/tests/test_column_specs.cpp: 5 smoke/linker tests (back-compat + 4 renderer types)
- cpp/tests/CMakeLists.txt: register test_column_specs target linked against fn_table_viz
- types/core/{cell_renderer,badge_rule,icon_map_entry,column_spec}.md: registry type mds
- docs/capabilities/data_table_renderers.md: canonical doc with end-to-end examples
- docs/capabilities/INDEX.md: added data-table-renderers group
All tests green: test_column_specs 5/5, test_fn_table_viz_smoke 8/8,
tql_emit 41/41, tql_apply 88/88, Wave-1 tests 8/8.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,13 @@ add_fn_test(test_pie_chart_math test_pie_chart_math.cpp)
|
||||
add_fn_test(test_kpi_card_math test_kpi_card_math.cpp)
|
||||
add_fn_test(test_bar_chart_math test_bar_chart_math.cpp)
|
||||
|
||||
# Issue 0081-F — auto_detect_type y compute_column_stats (extraidos del playground tables).
|
||||
add_fn_test(test_auto_detect_type test_auto_detect_type.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/auto_detect_type.cpp)
|
||||
add_fn_test(test_compute_column_stats test_compute_column_stats.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/auto_detect_type.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/compute_column_stats.cpp)
|
||||
|
||||
# Issue 0045 — tests de la logica pura extraida.
|
||||
add_fn_test(test_sql_parse test_sql_parse.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/sql_parse.cpp)
|
||||
@@ -136,6 +143,43 @@ else()
|
||||
target_link_libraries(test_graph_icons PRIVATE OpenGL::GL)
|
||||
endif()
|
||||
|
||||
# --- Issue 0081-B — compute_stage + compute_pipeline (TQL pure logic) -------
|
||||
# tql_helpers.cpp added (issue 0081-I): compute_stage.cpp now delegates
|
||||
# aggregation_alias to tql_helpers to avoid ODR conflict in fn_table_viz lib.
|
||||
add_fn_test(test_compute_stage test_compute_stage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/compute_stage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_helpers.cpp)
|
||||
add_fn_test(test_compute_pipeline test_compute_pipeline.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/compute_stage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/compute_pipeline.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_helpers.cpp)
|
||||
|
||||
# --- Issue 0081-E — join_tables: pure multi-key hash join --------------------
|
||||
add_fn_test(test_join_tables test_join_tables.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/join_tables.cpp)
|
||||
|
||||
# --- Issue 0081-G — viz_render: dispatcher ImPlot sobre StageOutput ---------
|
||||
# viz_render.cpp incluye imgui.h e implot.h y linkea contra ambas librerias.
|
||||
# El test NO inicializa GL ni contexto ImGui — solo ejercita las funciones
|
||||
# helper publicas (first_numeric_col, first_category_col, extract_numeric,
|
||||
# extract_category) que son logica pura sobre StageOutput.
|
||||
# render() requiere ImPlot context vivo: smoke real via primitives_gallery.
|
||||
add_fn_test(test_viz_render test_viz_render.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/viz/viz_render.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/auto_detect_type.cpp)
|
||||
target_include_directories(test_viz_render PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/imgui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/implot)
|
||||
target_link_libraries(test_viz_render PRIVATE imgui implot)
|
||||
|
||||
# --- lua_engine: motor Lua 5.4 sandbox (issue 0081-D) ----------------------
|
||||
# lua_engine.cpp incluye lua.h/lualib.h/lauxlib.h — requiere linkar lua54.
|
||||
# data_table_types.h esta en functions/core/ (ya en el include path de add_fn_test).
|
||||
add_fn_test(test_lua_engine test_lua_engine.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/lua_engine.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/auto_detect_type.cpp)
|
||||
target_link_libraries(test_lua_engine PRIVATE lua54)
|
||||
|
||||
# --- layout_storage: persistencia de last_active (restore-on-open) ---------
|
||||
# layout_storage.cpp incluye <imgui.h> y referencia ImGui::Save/LoadIniSettings*,
|
||||
# por eso necesitamos linkar contra imgui (compilado en el target del root
|
||||
@@ -145,6 +189,73 @@ add_fn_test(test_layout_storage test_layout_storage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/layout_storage.cpp)
|
||||
target_link_libraries(test_layout_storage PRIVATE SQLite::SQLite3 imgui)
|
||||
|
||||
# --- Issue 0081-C — tql_emit + tql_apply (TQL round-trip, pure) ------------
|
||||
# tql_helpers.cpp: pure token converters (no Lua, no ImGui).
|
||||
# tql_emit.cpp: State -> Lua text (no Lua runtime needed).
|
||||
# tql_apply.cpp: Lua text -> State (uses Lua 5.4 C API directly, not lua_engine).
|
||||
# Both tests use their own main() (no Catch2) matching fn run dispatch.
|
||||
add_executable(tql_emit_test
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_emit_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_emit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_helpers.cpp)
|
||||
target_include_directories(tql_emit_test PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework)
|
||||
add_test(NAME tql_emit_test COMMAND tql_emit_test)
|
||||
|
||||
add_executable(tql_apply_test
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_apply_test.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_apply.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_emit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_helpers.cpp)
|
||||
target_include_directories(tql_apply_test PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../framework)
|
||||
target_link_libraries(tql_apply_test PRIVATE lua54)
|
||||
add_test(NAME tql_apply_test COMMAND tql_apply_test)
|
||||
|
||||
# --- Issue 0081-I — fn_table_viz static lib smoke test ---------------------
|
||||
# Linker test: verifies that all 9 registry .cpp files in fn_table_viz resolve
|
||||
# symbols correctly when linked as a static lib. Does NOT call data_table::render
|
||||
# (requires ImGui context + playground headers). Uses its own main().
|
||||
if(TARGET fn_table_viz)
|
||||
add_executable(test_fn_table_viz_smoke
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_fn_table_viz_smoke.cpp)
|
||||
target_include_directories(test_fn_table_viz_smoke PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/imgui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/implot)
|
||||
target_link_libraries(test_fn_table_viz_smoke PRIVATE fn_table_viz)
|
||||
add_test(NAME test_fn_table_viz_smoke COMMAND test_fn_table_viz_smoke)
|
||||
endif()
|
||||
|
||||
# --- Issue 0081-N — declarative CellRenderer (Badge/Progress/Duration/Icon) --
|
||||
# Smoke + back-compat tests for TableInput.column_specs (v1.1.0).
|
||||
# Verifies type construction + link resolution; does NOT call render() (ImGui).
|
||||
if(TARGET fn_table_viz)
|
||||
add_executable(test_column_specs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_column_specs.cpp)
|
||||
target_include_directories(test_column_specs PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/imgui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../vendor/implot)
|
||||
target_link_libraries(test_column_specs PRIVATE fn_table_viz)
|
||||
add_test(NAME test_column_specs COMMAND test_column_specs)
|
||||
endif()
|
||||
|
||||
# --- Issue 0081 — tql_to_sql: pure TQL State -> SQL DuckDB emitter ----------
|
||||
# Pure logic: no DuckDB linked, no ImGui. Only data_table_types.h + tql_helpers.
|
||||
add_fn_test(test_tql_to_sql test_tql_to_sql.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_to_sql.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/tql_helpers.cpp)
|
||||
|
||||
# --- Issue 0081 — llm_anthropic: Anthropic API client pure helpers ----------
|
||||
# Only tests pure functions (build_request_body, extract_code_block,
|
||||
# parse_response_text) + call_api via FN_LLM_MOCK_RESPONSE injection.
|
||||
# Real HTTP roundtrip requires a valid API key (manual_test).
|
||||
add_fn_test(test_llm_anthropic test_llm_anthropic.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../functions/core/llm_anthropic.cpp)
|
||||
|
||||
# --- Visual golden-image diff (issue 0048) ---------------------------------
|
||||
# El binario primitives_gallery se compila con --capture; el test compara los
|
||||
# PNGs generados con los goldens en cpp/tests/golden/. Si no hay goldens o el
|
||||
|
||||
Reference in New Issue
Block a user