mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-12-01 16:56:34 +01:00
Restructure the test infrastructure with these changes: * Extend libctest with ctest_suite_t, ctest_parse_args, ctest_run_suites and CTEST_MAIN macro to standardize test entry points; support --grep / --grep= / --list / --interactive flags; add ctest-tests for self-tests. * Regroup tests by lib boundary: sink unit tests into lib/<name>/tests/ with <lib>_<topic> entry function names, move fixtures into lib/<name>/tests/fixtures/, rename top-level tests/cases/ to tests/integration/ for cross-lib integration tests. * Add tests/scenes/ for reusable widget tree builders shared by integration cases and visual preview binaries; add tests/previews/ with 4 diagnostic binaries (flex_layout, block_layout, widget_opacity, scrollbar). * Rewrite all describe/equal description strings using 'should ...' style or noun topic names; drop redundant lcui_quit/lcui_main calls from integration cases. * Integrate xmake test via add_tests(\default\) and a shared tests.runnable rule defined in the root xmake.lua; the rule wraps the test binary with drmemory (Windows) or valgrind (Linux) when option memcheck=y. * Drop the lcui-tests aggregation: lcui-tests now contains only integration cases and scenes, not the union of lib tests. Use xmake test to run everything across libs. * Fix .clang-format: InsertNewlineAtEndOfFile -> InsertNewlineAtEOF (correct key for clang-format 16+). * Update AGENTS.md with the new test layout, naming rules, description style and run commands. * Update CI to use xmake test and xmake f --memcheck=y instead of per-lib runs.
54 lines
1.6 KiB
C
54 lines
1.6 KiB
C
/*
|
|
* tests/main.c
|
|
*
|
|
* Copyright (c) 2023-2026, Liu Chao <i@lc-soft.io> All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* This file is part of LCUI, distributed under the MIT License found in the
|
|
* LICENSE.TXT file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include <LCUI.h>
|
|
#include <ctest.h>
|
|
|
|
extern void test_settings(void);
|
|
extern void test_clipboard(void);
|
|
extern void test_mainloop(void);
|
|
extern void test_router_components(void);
|
|
extern void test_widget_event(void);
|
|
extern void test_widget_rect(void);
|
|
extern void test_text_resize(void);
|
|
extern void test_textinput(void);
|
|
extern void test_font_face(void);
|
|
extern void test_widget_opacity(void);
|
|
extern void test_block_layout(void);
|
|
extern void test_flex_layout(void);
|
|
extern void test_scrollbar(void);
|
|
|
|
static const ctest_suite_t suites[] = {
|
|
{ "settings", test_settings },
|
|
{ "clipboard", test_clipboard },
|
|
{ "mainloop", test_mainloop },
|
|
{ "router components", test_router_components },
|
|
{ "widget event", test_widget_event },
|
|
{ "widget rect", test_widget_rect },
|
|
{ "text resize", test_text_resize },
|
|
{ "textinput", test_textinput },
|
|
{ "font face", test_font_face },
|
|
{ "widget opacity", test_widget_opacity },
|
|
{ "block layout", test_block_layout },
|
|
{ "flex layout", test_flex_layout },
|
|
{ "scrollbar", test_scrollbar },
|
|
{ NULL, NULL }
|
|
};
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
logger_set_level(LOGGER_LEVEL_ERROR);
|
|
if (ctest_parse_args(argc, argv) != 0) {
|
|
return 1;
|
|
}
|
|
return ctest_run_suites(suites);
|
|
}
|