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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "yasl/native.h"
#if YASL_HAS_WAYLAND
#include "yasl/native/wayland.h"
#endif
#if YASL_HAS_X11
#include "yasl/native/x11.h"
#endif
#if YASL_HAS_COCOA
#include "yasl/native/cocoa.h"
#endif
#include "yasl/loop.h"
#include <yasl/timing.h>
#include <yasl/yasl.h>
#include <cassert>
int main()
{
yasl_window_cbs callbacks{};
yasl_window_spec window{};
window.size = {640, 480};
window.cbs = &callbacks;
window.ud = &window;
assert(!yasl_surface_create_toplevel(nullptr, &window));
assert(!yasl_surface_create_native(nullptr, &window, &window));
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{};
event.key.key = YASL_KEY_A;
assert(event.key.key == YASL_KEY_A);
event.mouse.scroll = {0.25, -0.5};
assert(event.mouse.scroll.x == 0.25 && event.mouse.scroll.y == -0.5);
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
#if YASL_HAS_COCOA
assert(!yasl_cocoa_display_get_application(nullptr));
assert(!yasl_cocoa_surface_get_window(nullptr));
assert(!yasl_cocoa_surface_get_view(nullptr));
#endif
return 0;
}
|