fix(infra): gradle_run detecta android-sdk — issue 0076 #2
@@ -115,6 +115,19 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/apps/shaders_lab/CMakeLists.txt)
|
||||
add_subdirectory(apps/shaders_lab)
|
||||
endif()
|
||||
|
||||
# --- Primitives Gallery ---
|
||||
# Activado solo si la app esta presente Y todos sus deps tambien (button, toolbar...
|
||||
# son sources untracked en este worktree). Forzar con FN_BUILD_GALLERY=ON.
|
||||
if(FN_BUILD_GALLERY AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/apps/primitives_gallery/CMakeLists.txt)
|
||||
add_subdirectory(apps/primitives_gallery)
|
||||
endif()
|
||||
|
||||
# --- text_editor + file_watcher smoke test (issue 0025) ---
|
||||
# Build gate para validar que text_editor.cpp + file_watcher.cpp + vendor enlazan.
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/apps/text_editor_smoke/CMakeLists.txt)
|
||||
add_subdirectory(apps/text_editor_smoke)
|
||||
endif()
|
||||
|
||||
# --- Registry Dashboard (lives in projects/fn_monitoring/apps/) ---
|
||||
set(_DASH_DIR ${CMAKE_SOURCE_DIR}/../projects/fn_monitoring/apps/registry_dashboard)
|
||||
if(EXISTS ${_DASH_DIR}/CMakeLists.txt)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Smoke test app para validar que text_editor + file_watcher compilan
|
||||
# y enlazan correctamente. NO es una app del registry, solo build gate
|
||||
# de las funciones nuevas del issue 0025. Sin ImGui events runtime — el
|
||||
# test crea, settea texto, polea y destruye en 1 frame headless (no abre ventana).
|
||||
|
||||
add_imgui_app(text_editor_smoke
|
||||
main.cpp
|
||||
${CMAKE_SOURCE_DIR}/functions/core/text_editor.cpp
|
||||
${CMAKE_SOURCE_DIR}/functions/core/file_watcher.cpp
|
||||
${CMAKE_SOURCE_DIR}/vendor/imgui_text_edit/TextEditor.cpp
|
||||
)
|
||||
target_include_directories(text_editor_smoke PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/vendor/imgui_text_edit
|
||||
)
|
||||
@@ -0,0 +1,64 @@
|
||||
// Smoke test (no GUI): compila y ejecuta brevemente las APIs nuevas del
|
||||
// issue 0025 para validar que el wrapper PIMPL del text_editor y el
|
||||
// file_watcher (inotify Linux / ReadDirectoryChangesW Win) enlazan.
|
||||
//
|
||||
// No abre ventana ImGui — solo crea / settea texto / lee / poll / destruye.
|
||||
|
||||
#include "core/text_editor.h"
|
||||
#include "core/file_watcher.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
int main() {
|
||||
// ----- text_editor -----
|
||||
auto* ed = fn::text_editor_create(fn::CodeLang::GLSL);
|
||||
if (!ed) { std::fprintf(stderr, "text_editor_create returned null\n"); return 1; }
|
||||
|
||||
fn::text_editor_set_text(ed, "void main(){}\n");
|
||||
const char* got = fn::text_editor_get_text(ed);
|
||||
std::printf("text_editor: get_text -> %zu bytes\n", got ? std::strlen(got) : 0u);
|
||||
|
||||
if (fn::text_editor_is_dirty(ed)) {
|
||||
std::fprintf(stderr, "text_editor: dirty unexpected after set_text\n");
|
||||
return 1;
|
||||
}
|
||||
fn::text_editor_destroy(ed);
|
||||
|
||||
// ----- file_watcher -----
|
||||
const char* path = "/tmp/fn_smoke_test.txt";
|
||||
std::remove(path);
|
||||
{
|
||||
FILE* f = std::fopen(path, "w"); std::fputs("init\n", f); std::fclose(f);
|
||||
}
|
||||
|
||||
auto* fw = fn::file_watcher_create();
|
||||
if (!fw) { std::fprintf(stderr, "file_watcher_create returned null\n"); return 1; }
|
||||
|
||||
if (!fn::file_watcher_add(fw, path)) {
|
||||
std::fprintf(stderr, "file_watcher_add failed: %s\n", fn::file_watcher_last_error(fw));
|
||||
// Aun asi continuamos: en CI sin inotify (raro) este test seria flaky.
|
||||
}
|
||||
|
||||
// Modificar
|
||||
{
|
||||
FILE* f = std::fopen(path, "w"); std::fputs("changed\n", f); std::fclose(f);
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
|
||||
auto evs = fn::file_watcher_poll(fw);
|
||||
std::printf("file_watcher: %zu events\n", evs.size());
|
||||
for (auto& e : evs) {
|
||||
const char* kind = e.kind == fn::FileEvent::Modified ? "MOD"
|
||||
: e.kind == fn::FileEvent::Created ? "NEW" : "DEL";
|
||||
std::printf(" [%s] %s\n", kind, e.path.c_str());
|
||||
}
|
||||
|
||||
fn::file_watcher_destroy(fw);
|
||||
std::remove(path);
|
||||
std::printf("OK\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user