diff --git a/tests/integration/test_environment.c b/tests/integration/test_environment.c new file mode 100644 index 00000000..fb3214ae --- /dev/null +++ b/tests/integration/test_environment.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +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(); +} diff --git a/tests/main.c b/tests/main.c index 21bb7147..14baae6c 100644 --- a/tests/main.c +++ b/tests/main.c @@ -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 },