summaryrefslogtreecommitdiff
path: root/tests/test_api.cpp
blob: 9fb8525c22be5d029bc51016168d3e678065e328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "yasl/native.h"
#if YASL_HAS_WAYLAND
#include "yasl/native/wayland.h"
#endif
#if YASL_HAS_X11
#include "yasl/native/x11.h"
#endif
#include "yasl/loop.h"
#include <yasl/timing.h>
#include <yasl/yasl.h>
#include <cassert>

int main()
{
    yasl_timing timing = yasl_surface_timing(nullptr);
    assert(timing.source == YASL_TIMING_UNKNOWN);
    assert(yasl_scale_to_device(10.0, 240) == 20);
    yasl_geometry geometry = yasl_surface_geometry(nullptr);
    assert(geometry.scale_120 == YASL_SCALE_UNIT);
    assert(!yasl_display_get_native_handle(nullptr));
    assert(!yasl_surface_get_native_handle(nullptr));
    yasl_native_frame native{};
    assert(!yasl_surface_get_native_frame(nullptr, nullptr, &native));

    yasl_loop *loop = yasl_loop_create();
    assert(loop);
    assert(yasl_loop_step(loop, 0) >= 0);
    yasl_loop_destroy(loop);

    yasl_input_event event{};
    assert(!yasl_surface_input_poll(nullptr, &event));
    assert(!yasl_display_drag_start(nullptr, nullptr, nullptr, nullptr, nullptr));
    assert(!yasl_surface_drag_carry(nullptr, {0, 0}));

#if YASL_HAS_WAYLAND
    assert(!yasl_wayland_display_get_wl_display(nullptr));
    assert(!yasl_wayland_surface_get_wl_surface(nullptr));
#endif

#if YASL_HAS_X11
    assert(!yasl_x11_display_get_display(nullptr));
    assert(!yasl_x11_surface_get_window(nullptr));
#endif

    return 0;
}