mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
test: print environment details before test suites
Log display backend, metrics, screen size, fontconfig matches and font ids once so CI failures can be compared against the local environment.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <LCUI.h>
|
||||
#include <ctest-custom.h>
|
||||
|
||||
void test_environment(void)
|
||||
{
|
||||
char *mono, *sans, *serif;
|
||||
const char *display = getenv("DISPLAY");
|
||||
const char *wayland = getenv("WAYLAND_DISPLAY");
|
||||
|
||||
lcui_init();
|
||||
mono = pd_font_find_path("monospace");
|
||||
sans = pd_font_find_path("sans-serif");
|
||||
serif = pd_font_find_path("serif");
|
||||
|
||||
printf("[env] version: %s\n", lcui_get_version());
|
||||
printf("[env] display: DISPLAY=%s WAYLAND_DISPLAY=%s\n",
|
||||
display ? display : "(unset)", wayland ? wayland : "(unset)");
|
||||
printf("[env] metrics: dpi=%.2f scale=%.2f density=%.2f "
|
||||
"scaled_density=%.2f\n",
|
||||
ui_metrics.dpi, ui_metrics.scale, ui_metrics.density,
|
||||
ui_metrics.scaled_density);
|
||||
printf("[env] screen: %dx%d\n", ptk_screen_get_width(),
|
||||
ptk_screen_get_height());
|
||||
printf("[env] font monospace: %s\n", mono ? mono : "(none)");
|
||||
printf("[env] font sans-serif: %s\n", sans ? sans : "(none)");
|
||||
printf("[env] font serif: %s\n", serif ? serif : "(none)");
|
||||
printf("[env] font ids: monospace=%d sans-serif=%d serif=%d\n",
|
||||
pd_font_get_id("monospace", PD_FONT_STYLE_NORMAL,
|
||||
PD_FONT_WEIGHT_NORMAL),
|
||||
pd_font_get_id("sans-serif", PD_FONT_STYLE_NORMAL,
|
||||
PD_FONT_WEIGHT_NORMAL),
|
||||
pd_font_get_id("serif", PD_FONT_STYLE_NORMAL,
|
||||
PD_FONT_WEIGHT_NORMAL));
|
||||
|
||||
free(mono);
|
||||
free(sans);
|
||||
free(serif);
|
||||
lcui_destroy();
|
||||
}
|
||||
@@ -73,9 +73,11 @@ extern void test_breadcrumb(void);
|
||||
extern void test_input_group(void);
|
||||
extern void test_window_restore(void);
|
||||
extern void test_window_api(void);
|
||||
extern void test_environment(void);
|
||||
extern void test_window_events(void);
|
||||
|
||||
static const ctest_suite_t suites[] = {
|
||||
{ "environment", test_environment },
|
||||
{ "settings", test_settings },
|
||||
{ "clipboard", test_clipboard },
|
||||
{ "mainloop", test_mainloop },
|
||||
|
||||
Reference in New Issue
Block a user