zathura/tests/test_sandbox.c

50 lines
880 B
C
Raw Normal View History

2020-05-30 21:36:14 +02:00
/* SPDX-License-Identifier: Zlib */
#include <check.h>
#include "tests.h"
#include "zathura.h"
2020-05-30 21:36:14 +02:00
START_TEST(test_create)
{
zathura_t* zathura = zathura_create();
2020-06-01 19:32:21 +02:00
zathura->global.sandbox = ZATHURA_SANDBOX_STRICT;
2021-09-20 00:04:58 +02:00
ck_assert_ptr_nonnull(zathura);
ck_assert(zathura_init(zathura));
2020-05-30 21:36:14 +02:00
zathura_free(zathura);
}
END_TEST
2023-09-11 19:14:41 +02:00
static void
sandbox_setup(void)
{
setup();
#ifdef GDK_WINDOWING_X11
GdkDisplay* display = gdk_display_get_default();
ck_assert_msg(!GDK_IS_X11_DISPLAY(display), "Running under X11.");
#endif
}
2020-05-30 21:36:14 +02:00
static Suite*
suite_sandbox(void)
2020-05-30 21:36:14 +02:00
{
TCase* tcase = NULL;
Suite* suite = suite_create("Sandbox");
/* basic */
tcase = tcase_create("basic");
2023-09-11 19:14:41 +02:00
tcase_add_checked_fixture(tcase, sandbox_setup, NULL);
2020-05-30 21:36:14 +02:00
tcase_add_test(tcase, test_create);
suite_add_tcase(suite, tcase);
return suite;
}
int
main()
2020-05-30 21:36:14 +02:00
{
return run_suite(suite_sandbox());
}