aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.clang-tidy1
-rw-r--r--test/cpp/.clang-tidy1
-rw-r--r--test/cpp/meson.build2
-rw-r--r--test/cpp/test_build.cpp16
-rw-r--r--test/cpp/test_inline_cpp.cpp26
-rw-r--r--test/cpp/test_inline_objcpp.mm16
-rw-r--r--test/headers/meson.build3
-rw-r--r--test/meson.build31
-rw-r--r--test/test_build.c16
-rw-r--r--test/test_cairo.c8
-rw-r--r--test/test_clipboard.c4
-rw-r--r--test/test_cursor.c8
-rw-r--r--test/test_gl.c8
-rw-r--r--test/test_gl_free_unrealized.c6
-rw-r--r--test/test_gl_hints.c12
-rw-r--r--test/test_local_copy_paste.c8
-rw-r--r--test/test_realize.c8
-rw-r--r--test/test_redisplay.c10
-rw-r--r--test/test_remote_copy_paste.c10
-rw-r--r--test/test_show_hide.c8
-rw-r--r--test/test_size.c41
-rw-r--r--test/test_strerror.c2
-rw-r--r--test/test_stub.c8
-rw-r--r--test/test_stub_hints.c12
-rw-r--r--test/test_timer.c8
-rw-r--r--test/test_update.c8
-rw-r--r--test/test_utils.h571
-rw-r--r--test/test_view.c8
-rw-r--r--test/test_vulkan.c8
-rw-r--r--test/test_world.c2
30 files changed, 145 insertions, 725 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy
index 456eb2e..4dbdc80 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -3,7 +3,6 @@
Checks: >
-bugprone-multi-level-implicit-pointer-conversion,
- -bugprone-suspicious-include,
-cert-err33-c,
-cert-err34-c,
-clang-analyzer-optin.core.EnumCastOutOfRange,
diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy
index 1d936a2..fe7d8ec 100644
--- a/test/cpp/.clang-tidy
+++ b/test/cpp/.clang-tidy
@@ -5,6 +5,7 @@ Checks: >
-*-use-auto,
-*-use-nullptr,
-bugprone-easily-swappable-parameters,
+ -bugprone-suspicious-include,
-cert-dcl50-cpp,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
diff --git a/test/cpp/meson.build b/test/cpp/meson.build
index 73e2320..94c64d1 100644
--- a/test/cpp/meson.build
+++ b/test/cpp/meson.build
@@ -54,6 +54,7 @@ if host_machine.system() == 'darwin'
'test_inline_objcpp',
'test_inline_objcpp.mm',
dependencies: unified_deps,
+ implicit_include_directories: false,
include_directories: include_directories('../../include'),
objcpp_args: objcpp_unified_args,
),
@@ -99,6 +100,7 @@ elif is_variable('cpp')
'test_inline_cpp.cpp',
cpp_args: cpp_unified_args,
dependencies: unified_deps,
+ implicit_include_directories: false,
include_directories: include_directories('../../include'),
),
suite: 'unit',
diff --git a/test/cpp/test_build.cpp b/test/cpp/test_build.cpp
index 4fd2dac..2419be9 100644
--- a/test/cpp/test_build.cpp
+++ b/test/cpp/test_build.cpp
@@ -1,17 +1,13 @@
// Copyright 2020 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-/*
- Tests that C++ headers compile without any warnings.
-*/
+// Tests that C++ headers compile without any warnings
-#define PUGL_DISABLE_DEPRECATED
-
-#include "pugl/cairo.hpp" // IWYU pragma: keep
-#include "pugl/gl.hpp" // IWYU pragma: keep
-#include "pugl/pugl.h" // IWYU pragma: keep
-#include "pugl/pugl.hpp" // IWYU pragma: keep
-#include "pugl/stub.hpp" // IWYU pragma: keep
+#include <pugl/cairo.hpp> // IWYU pragma: keep
+#include <pugl/gl.hpp> // IWYU pragma: keep
+#include <pugl/pugl.h> // IWYU pragma: keep
+#include <pugl/pugl.hpp> // IWYU pragma: keep
+#include <pugl/stub.hpp> // IWYU pragma: keep
int
main()
diff --git a/test/cpp/test_inline_cpp.cpp b/test/cpp/test_inline_cpp.cpp
index f5694eb..4c47ffb 100644
--- a/test/cpp/test_inline_cpp.cpp
+++ b/test/cpp/test_inline_cpp.cpp
@@ -23,34 +23,34 @@
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
-#include "../src/common.c" // IWYU pragma: keep
-#include "../src/internal.c" // IWYU pragma: keep
+#include "../../src/common.c" // IWYU pragma: keep
+#include "../../src/internal.c" // IWYU pragma: keep
#if defined(_WIN32)
-# include "../src/win.c" // IWYU pragma: keep
-# include "../src/win.h" // IWYU pragma: keep
-# include "../src/win_stub.c" // IWYU pragma: keep
+# include "../../src/win.c" // IWYU pragma: keep
+# include "../../src/win.h" // IWYU pragma: keep
+# include "../../src/win_stub.c" // IWYU pragma: keep
# if defined(WITH_CAIRO)
-# include "../src/win_cairo.c" // IWYU pragma: keep
+# include "../../src/win_cairo.c" // IWYU pragma: keep
# endif
# if defined(WITH_OPENGL)
-# include "../src/win_gl.c" // IWYU pragma: keep
+# include "../../src/win_gl.c" // IWYU pragma: keep
# endif
# if defined(WITH_VULKAN)
-# include "../src/win_vulkan.c" // IWYU pragma: keep
+# include "../../src/win_vulkan.c" // IWYU pragma: keep
# endif
#else
-# include "../src/x11.c" // IWYU pragma: keep
-# include "../src/x11_stub.c" // IWYU pragma: keep
+# include "../../src/x11.c" // IWYU pragma: keep
+# include "../../src/x11_stub.c" // IWYU pragma: keep
# if defined(WITH_CAIRO)
-# include "../src/x11_cairo.c" // IWYU pragma: keep
+# include "../../src/x11_cairo.c" // IWYU pragma: keep
# endif
# if defined(WITH_OPENGL)
-# include "../src/x11_gl.c" // IWYU pragma: keep
+# include "../../src/x11_gl.c" // IWYU pragma: keep
# endif
# if defined(WITH_VULKAN)
-# include "../src/x11_vulkan.c" // IWYU pragma: keep
+# include "../../src/x11_vulkan.c" // IWYU pragma: keep
# endif
#endif
diff --git a/test/cpp/test_inline_objcpp.mm b/test/cpp/test_inline_objcpp.mm
index 1c9079b..b4d65c6 100644
--- a/test/cpp/test_inline_objcpp.mm
+++ b/test/cpp/test_inline_objcpp.mm
@@ -9,22 +9,22 @@
# pragma clang diagnostic ignored "-Wold-style-cast"
#endif
-#include "../src/common.c" // IWYU pragma: keep
-#include "../src/internal.c" // IWYU pragma: keep
-#include "../src/mac.h" // IWYU pragma: keep
-#include "../src/mac.m" // IWYU pragma: keep
-#include "../src/mac_stub.m" // IWYU pragma: keep
+#include "../../src/common.c" // IWYU pragma: keep
+#include "../../src/internal.c" // IWYU pragma: keep
+#include "../../src/mac.h" // IWYU pragma: keep
+#include "../../src/mac.m" // IWYU pragma: keep
+#include "../../src/mac_stub.m" // IWYU pragma: keep
#if defined(WITH_CAIRO)
-# include "../src/mac_cairo.m" // IWYU pragma: keep
+# include "../../src/mac_cairo.m" // IWYU pragma: keep
#endif
#if defined(WITH_OPENGL)
-# include "../src/mac_gl.m" // IWYU pragma: keep
+# include "../../src/mac_gl.m" // IWYU pragma: keep
#endif
#if defined(WITH_VULKAN)
-# include "../src/mac_vulkan.m" // IWYU pragma: keep
+# include "../../src/mac_vulkan.m" // IWYU pragma: keep
#endif
#if defined(__clang__)
diff --git a/test/headers/meson.build b/test/headers/meson.build
index c0adabd..69fd51b 100644
--- a/test/headers/meson.build
+++ b/test/headers/meson.build
@@ -11,7 +11,7 @@ if get_option('warning_level') == 'everything'
endif
endif
-header_c_suppressions = cpp.get_supported_arguments(header_c_suppressions)
+header_c_suppressions = cc.get_supported_arguments(header_c_suppressions)
test_headers_c_args = header_c_suppressions
test_headers_c_args += [
@@ -30,6 +30,7 @@ test(
files('test_headers.c'),
c_args: test_headers_c_args,
dependencies: [pugl_dep, vulkan_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
diff --git a/test/meson.build b/test/meson.build
index f015596..f047ff0 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,4 +1,4 @@
-# Copyright 2021-2023 David Robillard <d@drobilla.net>
+# Copyright 2021-2025 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: 0BSD OR ISC
# Suppress some additional C warnings in tests
@@ -56,11 +56,6 @@ if with_timers
basic_tests += ['timer']
endif
-includes = [
- '.',
- '../include',
-]
-
foreach test : basic_tests
test(
test,
@@ -68,8 +63,8 @@ foreach test : basic_tests
'test_' + test,
'test_@0@.c'.format(test),
c_args: test_c_args,
- dependencies: [pugl_dep, pugl_stub_dep],
- include_directories: include_directories(includes),
+ dependencies: [pugl_dep, pugl_stub_dep, puglutil_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
@@ -82,8 +77,8 @@ foreach test : basic_exclusive_tests
'test_' + test,
'test_@0@.c'.format(test),
c_args: test_c_args,
- dependencies: [pugl_dep, pugl_stub_dep],
- include_directories: include_directories(includes),
+ dependencies: [pugl_dep, pugl_stub_dep, puglutil_dep],
+ implicit_include_directories: false,
),
is_parallel: false,
suite: 'unit',
@@ -98,8 +93,8 @@ if opengl_dep.found()
'test_' + test,
'test_@0@.c'.format(test),
c_args: test_c_args,
- dependencies: [pugl_dep, pugl_gl_dep],
- include_directories: include_directories(includes),
+ dependencies: [pugl_dep, pugl_gl_dep, puglutil_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
@@ -114,8 +109,8 @@ if cairo_dep.found()
'test_' + test,
'test_@0@.c'.format(test),
c_args: test_c_args + cairo_args,
- dependencies: [pugl_dep, pugl_cairo_dep],
- include_directories: include_directories(includes),
+ dependencies: [pugl_dep, pugl_cairo_dep, puglutil_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
@@ -130,8 +125,8 @@ if vulkan_dep.found()
'test_' + test,
'test_@0@.c'.format(test),
c_args: test_c_args,
- dependencies: [pugl_dep, pugl_vulkan_dep],
- include_directories: include_directories(includes),
+ dependencies: [pugl_dep, pugl_vulkan_dep, puglutil_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
@@ -148,4 +143,6 @@ subdir('headers')
# C++ / Objective C++ #
#######################
-subdir('cpp')
+if is_variable('cpp')
+ subdir('cpp')
+endif
diff --git a/test/test_build.c b/test/test_build.c
index e28df3c..4f66eca 100644
--- a/test/test_build.c
+++ b/test/test_build.c
@@ -1,17 +1,13 @@
// Copyright 2020 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-/*
- Tests that C headers compile without any warnings.
-*/
+// Tests that C headers compile without any warnings
-#define PUGL_DISABLE_DEPRECATED
-
-#include "pugl/cairo.h" // IWYU pragma: keep
-#include "pugl/gl.h" // IWYU pragma: keep
-#include "pugl/glu.h" // IWYU pragma: keep
-#include "pugl/pugl.h" // IWYU pragma: keep
-#include "pugl/stub.h" // IWYU pragma: keep
+#include <pugl/cairo.h> // IWYU pragma: keep
+#include <pugl/gl.h> // IWYU pragma: keep
+#include <pugl/glu.h> // IWYU pragma: keep
+#include <pugl/pugl.h> // IWYU pragma: keep
+#include <pugl/stub.h> // IWYU pragma: keep
int
main(void)
diff --git a/test/test_cairo.c b/test/test_cairo.c
index 11d6cce..9abc51e 100644
--- a/test/test_cairo.c
+++ b/test/test_cairo.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/cairo.h"
-#include "pugl/pugl.h"
+#include <pugl/cairo.h>
+#include <pugl/pugl.h>
#include <cairo.h>
@@ -66,7 +66,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglCairoBackend());
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 128, 896);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 128, 896);
puglShow(test.view, PUGL_SHOW_RAISE);
// Drive event loop until the view gets exposed
diff --git a/test/test_clipboard.c b/test/test_clipboard.c
index debe8e3..054f71d 100644
--- a/test/test_clipboard.c
+++ b/test/test_clipboard.c
@@ -9,8 +9,8 @@
#include "test_utils.h"
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
diff --git a/test/test_cursor.c b/test/test_cursor.c
index 9b0fa66..399f797 100644
--- a/test/test_cursor.c
+++ b/test/test_cursor.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -52,7 +52,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 896, 640);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 896, 640);
puglShow(test.view, PUGL_SHOW_RAISE);
// Drive event loop until the view gets exposed
diff --git a/test/test_gl.c b/test/test_gl.c
index 8854cad..dac41b5 100644
--- a/test/test_gl.c
+++ b/test/test_gl.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/gl.h"
-#include "pugl/pugl.h"
+#include <pugl/gl.h>
+#include <pugl/pugl.h>
#include <assert.h>
#include <stdbool.h>
@@ -85,7 +85,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglGlBackend());
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 384, 896);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 384, 896);
puglShow(test.view, PUGL_SHOW_RAISE);
// Enter OpenGL context as if setting things up
diff --git a/test/test_gl_free_unrealized.c b/test/test_gl_free_unrealized.c
index ba0d895..7ff8913 100644
--- a/test/test_gl_free_unrealized.c
+++ b/test/test_gl_free_unrealized.c
@@ -9,8 +9,8 @@
#undef NDEBUG
-#include "pugl/gl.h"
-#include "pugl/pugl.h"
+#include <pugl/gl.h>
+#include <pugl/pugl.h>
#include <assert.h>
#include <stddef.h>
@@ -32,7 +32,7 @@ main(void)
puglSetBackend(test.view, puglGlBackend());
puglSetHandle(test.view, &test);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 640, 896);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 640, 896);
assert(!puglGetVisible(test.view));
diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c
index 250136a..824679a 100644
--- a/test/test_gl_hints.c
+++ b/test/test_gl_hints.c
@@ -1,16 +1,14 @@
// Copyright 2020 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-/*
- Tests that all hints are set to real values after a view is realized.
-*/
+// Tests that all hints are set to real values after a view is realized
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/gl.h"
-#include "pugl/pugl.h"
+#include <pugl/gl.h>
+#include <pugl/pugl.h>
#include <assert.h>
@@ -35,7 +33,7 @@ main(void)
puglSetBackend(view, puglGlBackend());
puglSetEventFunc(view, onEvent);
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(view, 128, 128);
+ puglSetPositionHint(view, PUGL_DEFAULT_POSITION, 128, 128);
// Check invalid cases
assert(puglSetViewHint(view, PUGL_CONTEXT_API, PUGL_DONT_CARE) ==
diff --git a/test/test_local_copy_paste.c b/test/test_local_copy_paste.c
index 737f193..6d4899e 100644
--- a/test/test_local_copy_paste.c
+++ b/test/test_local_copy_paste.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -133,7 +133,7 @@ main(int argc, char** argv)
puglSetHandle(app.view, &app);
puglSetEventFunc(app.view, onEvent);
puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(app.view, 384, 128);
+ puglSetPositionHint(app.view, PUGL_DEFAULT_POSITION, 384, 128);
// Create and show window
assert(!puglRealize(app.view));
diff --git a/test/test_realize.c b/test/test_realize.c
index 7e37319..3d706ce 100644
--- a/test/test_realize.c
+++ b/test/test_realize.c
@@ -11,10 +11,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -75,7 +75,7 @@ main(int argc, char** argv)
assert(puglRealize(test.view) == PUGL_BAD_CONFIGURATION);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 640, 128);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 640, 128);
// Create initially invisible window
assert(!puglRealize(test.view));
diff --git a/test/test_redisplay.c b/test/test_redisplay.c
index ae7267d..01be5b6 100644
--- a/test/test_redisplay.c
+++ b/test/test_redisplay.c
@@ -8,10 +8,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -119,7 +119,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 896, 128);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 896, 128);
// Create and show window
assert(!puglRealize(test.view));
@@ -129,7 +129,7 @@ main(int argc, char** argv)
}
// Send a custom event to trigger a redisplay in the event loop
- PuglEvent client_event = {{PUGL_CLIENT, 0}};
+ PuglEvent client_event = {{PUGL_CLIENT, 0U}};
client_event.client.data1 = obscureId;
client_event.client.data2 = 0;
assert(!puglSendEvent(test.view, &client_event));
diff --git a/test/test_remote_copy_paste.c b/test/test_remote_copy_paste.c
index a9f079e..3d1756b 100644
--- a/test/test_remote_copy_paste.c
+++ b/test/test_remote_copy_paste.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -148,7 +148,7 @@ main(int argc, char** argv)
puglSetHandle(app.copierView, &app);
puglSetEventFunc(app.copierView, onCopierEvent);
puglSetSizeHint(app.copierView, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(app.copierView, 640, 896);
+ puglSetPositionHint(app.copierView, PUGL_DEFAULT_POSITION, 640, 896);
// Set up paster view
app.pasterView = puglNewView(app.world);
@@ -158,7 +158,7 @@ main(int argc, char** argv)
puglSetHandle(app.pasterView, &app);
puglSetEventFunc(app.pasterView, onPasterEvent);
puglSetSizeHint(app.pasterView, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(app.pasterView, 896, 896);
+ puglSetPositionHint(app.pasterView, PUGL_DEFAULT_POSITION, 896, 896);
// Create and show both views
assert(!puglShow(app.copierView, PUGL_SHOW_RAISE));
diff --git a/test/test_show_hide.c b/test/test_show_hide.c
index 1517203..8b67325 100644
--- a/test/test_show_hide.c
+++ b/test/test_show_hide.c
@@ -8,10 +8,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -115,7 +115,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 128, 384);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 128, 384);
// Create initially invisible window
assert(!puglRealize(test.view));
diff --git a/test/test_size.c b/test/test_size.c
index e3f738a..9c9f518 100644
--- a/test/test_size.c
+++ b/test/test_size.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -26,7 +26,8 @@ typedef struct {
PuglView* view;
PuglTestOptions opts;
State state;
- PuglRect configuredFrame;
+ PuglPoint configuredPos;
+ PuglArea configuredSize;
} PuglTest;
static PuglStatus
@@ -47,10 +48,10 @@ onEvent(PuglView* view, const PuglEvent* event)
if (test->state == REALIZED) {
test->state = CONFIGURED;
}
- test->configuredFrame.x = event->configure.x;
- test->configuredFrame.y = event->configure.y;
- test->configuredFrame.width = event->configure.width;
- test->configuredFrame.height = event->configure.height;
+ test->configuredPos.x = event->configure.x;
+ test->configuredPos.y = event->configure.y;
+ test->configuredSize.width = event->configure.width;
+ test->configuredSize.height = event->configure.height;
break;
case PUGL_UNREALIZE:
test->state = UNREALIZED;
@@ -73,7 +74,8 @@ main(int argc, char** argv)
NULL,
puglParseTestOptions(&argc, &argv),
START,
- {0, 0, 0U, 0U}};
+ {0, 0},
+ {0U, 0U}};
// Set up view with size bounds and an aspect ratio
test.view = puglNewView(test.world);
@@ -87,7 +89,7 @@ main(int argc, char** argv)
puglSetSizeHint(test.view, PUGL_MIN_SIZE, minSize, minSize);
puglSetSizeHint(test.view, PUGL_MAX_SIZE, maxSize, maxSize);
puglSetSizeHint(test.view, PUGL_FIXED_ASPECT, 1, 1);
- puglSetPosition(test.view, 384, 384);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 384, 384);
// Create and show window
assert(!puglRealize(test.view));
@@ -97,21 +99,22 @@ main(int argc, char** argv)
}
// Check that the frame matches the last configure event
- const PuglRect frame = puglGetFrame(test.view);
- assert(frame.x == test.configuredFrame.x);
- assert(frame.y == test.configuredFrame.y);
- assert(frame.width == test.configuredFrame.width);
- assert(frame.height == test.configuredFrame.height);
+ const PuglPoint pos = puglGetPositionHint(test.view, PUGL_CURRENT_POSITION);
+ const PuglArea size = puglGetSizeHint(test.view, PUGL_CURRENT_SIZE);
+ assert(pos.x == test.configuredPos.x);
+ assert(pos.y == test.configuredPos.y);
+ assert(size.width == test.configuredSize.width);
+ assert(size.height == test.configuredSize.height);
#if defined(_WIN32) || defined(__APPLE__)
/* Some window managers on Linux (particularly tiling ones) just disregard
these hints entirely, so we only check that the size is in bounds on MacOS
and Windows where this is more or less universally supported. */
- assert(frame.width >= minSize);
- assert(frame.height >= minSize);
- assert(frame.width <= maxSize);
- assert(frame.height <= maxSize);
+ assert(size.width >= minSize);
+ assert(size.height >= minSize);
+ assert(size.width <= maxSize);
+ assert(size.height <= maxSize);
#endif
// Tear down
diff --git a/test/test_strerror.c b/test/test_strerror.c
index c120a93..4bce4eb 100644
--- a/test/test_strerror.c
+++ b/test/test_strerror.c
@@ -5,7 +5,7 @@
#undef NDEBUG
-#include "pugl/pugl.h"
+#include <pugl/pugl.h>
#include <assert.h>
#include <ctype.h>
diff --git a/test/test_stub.c b/test/test_stub.c
index bd8a0eb..7913fd4 100644
--- a/test/test_stub.c
+++ b/test/test_stub.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -52,7 +52,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglStubBackend());
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 384, 896);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 384, 896);
puglShow(test.view, PUGL_SHOW_RAISE);
// Drive event loop until the view gets exposed
diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c
index b7d54e3..5694261 100644
--- a/test/test_stub_hints.c
+++ b/test/test_stub_hints.c
@@ -1,16 +1,14 @@
// Copyright 2020 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-/*
- Tests that all hints are set to real values after a view is realized.
-*/
+// Tests that all hints are set to real values after a view is realized
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
@@ -35,7 +33,7 @@ main(void)
puglSetBackend(view, puglStubBackend());
puglSetEventFunc(view, onEvent);
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(view, 640, 384);
+ puglSetPositionHint(view, PUGL_DEFAULT_POSITION, 640, 384);
// Check invalid cases
assert(puglSetViewHint(view, (PuglViewHint)-1, 0) == PUGL_BAD_PARAMETER);
diff --git a/test/test_timer.c b/test/test_timer.c
index 405a5c2..8015b9a 100644
--- a/test/test_timer.c
+++ b/test/test_timer.c
@@ -8,10 +8,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <math.h>
@@ -157,7 +157,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 896, 384);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 896, 384);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_update.c b/test/test_update.c
index c5997ba..c078e6b 100644
--- a/test/test_update.c
+++ b/test/test_update.c
@@ -8,10 +8,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -90,7 +90,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 128, 640);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 128, 640);
// Create and show window
assert(!puglRealize(test.view));
diff --git a/test/test_utils.h b/test/test_utils.h
deleted file mode 100644
index 4ebd985..0000000
--- a/test/test_utils.h
+++ /dev/null
@@ -1,571 +0,0 @@
-// Copyright 2012-2023 David Robillard <d@drobilla.net>
-// SPDX-License-Identifier: ISC
-
-#ifndef TEST_TEST_UTILS_H
-#define TEST_TEST_UTILS_H
-
-#include "pugl/pugl.h"
-
-#include <inttypes.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef __GNUC__
-# define PUGL_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
-#else
-# define PUGL_LOG_FUNC(fmt, arg1)
-#endif
-
-typedef struct {
- int samples;
- int doubleBuffer;
- int sync;
- int glApi;
- int glMajorVersion;
- int glMinorVersion;
- bool continuous;
- bool help;
- bool ignoreKeyRepeat;
- bool resizable;
- bool verbose;
- bool errorChecking;
-} PuglTestOptions;
-
-PUGL_LOG_FUNC(1, 2)
-static int
-logError(const char* fmt, ...)
-{
- fprintf(stderr, "error: ");
-
- va_list args; // NOLINT
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
-
- return 1;
-}
-
-static inline int
-printModifiers(const uint32_t mods)
-{
- return fprintf(stderr,
- "Modifiers:%s%s%s%s%s%s%s\n",
- (mods & PUGL_MOD_SHIFT) ? " Shift" : "",
- (mods & PUGL_MOD_CTRL) ? " Ctrl" : "",
- (mods & PUGL_MOD_ALT) ? " Alt" : "",
- (mods & PUGL_MOD_SUPER) ? " Super" : "",
- (mods & PUGL_MOD_NUM_LOCK) ? " Num" : "",
- (mods & PUGL_MOD_SCROLL_LOCK) ? " Scroll" : "",
- (mods & PUGL_MOD_CAPS_LOCK) ? " Caps" : "");
-}
-
-static inline const char*
-crossingModeString(const PuglCrossingMode mode)
-{
- switch (mode) {
- case PUGL_CROSSING_NORMAL:
- return "normal";
- case PUGL_CROSSING_GRAB:
- return "grab";
- case PUGL_CROSSING_UNGRAB:
- return "ungrab";
- }
-
- return "unknown";
-}
-
-static inline const char*
-scrollDirectionString(const PuglScrollDirection direction)
-{
- switch (direction) {
- case PUGL_SCROLL_UP:
- return "up";
- case PUGL_SCROLL_DOWN:
- return "down";
- case PUGL_SCROLL_LEFT:
- return "left";
- case PUGL_SCROLL_RIGHT:
- return "right";
- case PUGL_SCROLL_SMOOTH:
- return "smooth";
- }
-
- return "unknown";
-}
-
-static inline const char*
-viewStyleFlagString(const PuglViewStyleFlag state)
-{
- switch (state) {
- case PUGL_VIEW_STYLE_MODAL:
- return "modal";
- case PUGL_VIEW_STYLE_TALL:
- return "tall";
- case PUGL_VIEW_STYLE_WIDE:
- return "wide";
- case PUGL_VIEW_STYLE_HIDDEN:
- return "hidden";
- case PUGL_VIEW_STYLE_FULLSCREEN:
- return "fullscreen";
- case PUGL_VIEW_STYLE_ABOVE:
- return "above";
- case PUGL_VIEW_STYLE_BELOW:
- return "below";
- case PUGL_VIEW_STYLE_DEMANDING:
- return "demanding";
- case PUGL_VIEW_STYLE_RESIZING:
- return "resizing";
- case PUGL_VIEW_STYLE_MAPPED:
- return "mapped";
- }
-
- return "unknown";
-}
-
-static inline const char*
-keyString(const uint32_t key)
-{
- switch (key) {
- case PUGL_KEY_BACKSPACE:
- return "BACKSPACE";
- case PUGL_KEY_TAB:
- return "TAB";
- case PUGL_KEY_ENTER:
- return "ENTER";
- case PUGL_KEY_ESCAPE:
- return "ESCAPE";
- case PUGL_KEY_DELETE:
- return "DELETE";
- case PUGL_KEY_SPACE:
- return "SPACE";
-
- case PUGL_KEY_F1:
- return "F1";
- case PUGL_KEY_F2:
- return "F2";
- case PUGL_KEY_F3:
- return "F3";
- case PUGL_KEY_F4:
- return "F4";
- case PUGL_KEY_F5:
- return "F5";
- case PUGL_KEY_F6:
- return "F6";
- case PUGL_KEY_F7:
- return "F7";
- case PUGL_KEY_F8:
- return "F8";
- case PUGL_KEY_F9:
- return "F9";
- case PUGL_KEY_F10:
- return "F10";
- case PUGL_KEY_F11:
- return "F11";
- case PUGL_KEY_F12:
- return "F12";
-
- case PUGL_KEY_PAGE_UP:
- return "PAGE_UP";
- case PUGL_KEY_PAGE_DOWN:
- return "PAGE_DOWN";
- case PUGL_KEY_END:
- return "END";
- case PUGL_KEY_HOME:
- return "HOME";
- case PUGL_KEY_LEFT:
- return "LEFT";
- case PUGL_KEY_UP:
- return "UP";
- case PUGL_KEY_RIGHT:
- return "RIGHT";
- case PUGL_KEY_DOWN:
- return "DOWN";
-
- case PUGL_KEY_PRINT_SCREEN:
- return "PRINT_SCREEN";
- case PUGL_KEY_INSERT:
- return "INSERT";
- case PUGL_KEY_PAUSE:
- return "PAUSE";
- case PUGL_KEY_MENU:
- return "MENU";
- case PUGL_KEY_NUM_LOCK:
- return "NUM_LOCK";
- case PUGL_KEY_SCROLL_LOCK:
- return "SCROLL_LOCK";
- case PUGL_KEY_CAPS_LOCK:
- return "CAPS_LOCK";
-
- case PUGL_KEY_SHIFT_L:
- return "SHIFT_L";
- case PUGL_KEY_SHIFT_R:
- return "SHIFT_R";
- case PUGL_KEY_CTRL_L:
- return "CTRL_L";
- case PUGL_KEY_CTRL_R:
- return "CTRL_R";
- case PUGL_KEY_ALT_L:
- return "ALT_L";
- case PUGL_KEY_ALT_R:
- return "ALT_R";
- case PUGL_KEY_SUPER_L:
- return "SUPER_L";
- case PUGL_KEY_SUPER_R:
- return "SUPER_R";
-
- case PUGL_KEY_PAD_0:
- return "PAD_0";
- case PUGL_KEY_PAD_1:
- return "PAD_1";
- case PUGL_KEY_PAD_2:
- return "PAD_2";
- case PUGL_KEY_PAD_3:
- return "PAD_3";
- case PUGL_KEY_PAD_4:
- return "PAD_4";
- case PUGL_KEY_PAD_5:
- return "PAD_5";
- case PUGL_KEY_PAD_6:
- return "PAD_6";
- case PUGL_KEY_PAD_7:
- return "PAD_7";
- case PUGL_KEY_PAD_8:
- return "PAD_8";
- case PUGL_KEY_PAD_9:
- return "PAD_9";
- case PUGL_KEY_PAD_ENTER:
- return "PAD_ENTER";
-
- case PUGL_KEY_PAD_PAGE_UP:
- return "PAD_PAGE_UP";
- case PUGL_KEY_PAD_PAGE_DOWN:
- return "PAD_PAGE_DOWN";
- case PUGL_KEY_PAD_END:
- return "PAD_END";
- case PUGL_KEY_PAD_HOME:
- return "PAD_HOME";
- case PUGL_KEY_PAD_LEFT:
- return "PAD_LEFT";
- case PUGL_KEY_PAD_UP:
- return "PAD_UP";
- case PUGL_KEY_PAD_RIGHT:
- return "PAD_RIGHT";
- case PUGL_KEY_PAD_DOWN:
- return "PAD_DOWN";
-
- case PUGL_KEY_PAD_CLEAR:
- return "PAD_CLEAR";
- case PUGL_KEY_PAD_INSERT:
- return "PAD_INSERT";
- case PUGL_KEY_PAD_DELETE:
- return "PAD_DELETE";
- case PUGL_KEY_PAD_EQUAL:
- return "PAD_EQUAL";
-
- case PUGL_KEY_PAD_MULTIPLY:
- return "PAD_MULTIPLY";
- case PUGL_KEY_PAD_ADD:
- return "PAD_ADD";
- case PUGL_KEY_PAD_SEPARATOR:
- return "PAD_SEPARATOR";
- case PUGL_KEY_PAD_SUBTRACT:
- return "PAD_SUBTRACT";
- case PUGL_KEY_PAD_DECIMAL:
- return "PAD_DECIMAL";
- case PUGL_KEY_PAD_DIVIDE:
- return "PAD_DIVIDE";
- }
-
- return "";
-}
-
-static inline int
-printEvent(const PuglEvent* event, const char* prefix, const bool verbose)
-{
-#define PFFMT "%6.1f %6.1f"
-#define PIFMT "%5d %5d"
-#define PUFMT "%5u %5u"
-
-#define PRINT(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
-
- switch (event->type) {
- case PUGL_NOTHING:
- return 0;
- case PUGL_REALIZE:
- return fprintf(stderr, "%sRealize\n", prefix);
- case PUGL_UNREALIZE:
- return fprintf(stderr, "%sUnrealize\n", prefix);
- case PUGL_KEY_PRESS:
- return (PRINT("%sKey press code %3u key U+%04X (%s) ",
- prefix,
- event->key.keycode,
- event->key.key,
- keyString(event->key.key)) +
- printModifiers(event->scroll.state));
- case PUGL_KEY_RELEASE:
- return (PRINT("%sKey release code %3u key U+%04X (%s) ",
- prefix,
- event->key.keycode,
- event->key.key,
- keyString(event->key.key)) +
- printModifiers(event->scroll.state));
- case PUGL_TEXT:
- return PRINT("%sText entry code %3u char U+%04X (%s)\n",
- prefix,
- event->text.keycode,
- event->text.character,
- event->text.string);
- case PUGL_BUTTON_PRESS:
- case PUGL_BUTTON_RELEASE:
- return (PRINT("%sMouse %u %s at " PFFMT " ",
- prefix,
- event->button.button,
- (event->type == PUGL_BUTTON_PRESS) ? "down" : "up ",
- event->button.x,
- event->button.y) +
- printModifiers(event->scroll.state));
- case PUGL_SCROLL:
- return (PRINT("%sScroll %5.1f %5.1f (%s) at " PFFMT " ",
- prefix,
- event->scroll.dx,
- event->scroll.dy,
- scrollDirectionString(event->scroll.direction),
- event->scroll.x,
- event->scroll.y) +
- printModifiers(event->scroll.state));
- case PUGL_POINTER_IN:
- return PRINT("%sMouse enter at " PFFMT " (%s)\n",
- prefix,
- event->crossing.x,
- event->crossing.y,
- crossingModeString(event->crossing.mode));
- case PUGL_POINTER_OUT:
- return PRINT("%sMouse leave at " PFFMT " (%s)\n",
- prefix,
- event->crossing.x,
- event->crossing.y,
- crossingModeString(event->crossing.mode));
- case PUGL_FOCUS_IN:
- return PRINT(
- "%sFocus in (%s)\n", prefix, crossingModeString(event->crossing.mode));
- case PUGL_FOCUS_OUT:
- return PRINT(
- "%sFocus out (%s)\n", prefix, crossingModeString(event->crossing.mode));
- case PUGL_CLIENT:
- return PRINT("%sClient %" PRIXPTR " %" PRIXPTR "\n",
- prefix,
- event->client.data1,
- event->client.data2);
- case PUGL_LOOP_ENTER:
- return PRINT("%sLoop enter\n", prefix);
- case PUGL_LOOP_LEAVE:
- return PRINT("%sLoop leave\n", prefix);
- case PUGL_DATA_OFFER:
- return PRINT("%sData offer\n", prefix);
- case PUGL_DATA:
- return PRINT("%sData\n", prefix);
- default:
- break;
- }
-
- if (verbose) {
- switch (event->type) {
- case PUGL_UPDATE:
- return fprintf(stderr, "%sUpdate\n", prefix);
- case PUGL_CONFIGURE:
- PRINT("%sConfigure " PIFMT " " PUFMT " (",
- prefix,
- event->configure.x,
- event->configure.y,
- event->configure.width,
- event->configure.height);
- for (PuglViewStyleFlags mask = 1U; mask <= PUGL_MAX_VIEW_STYLE_FLAG;
- mask <<= 1U) {
- if (event->configure.style & mask) {
- PRINT(" %s", viewStyleFlagString((PuglViewStyleFlag)mask));
- }
- }
- PRINT("%s\n", " )");
- return 0;
- case PUGL_EXPOSE:
- return PRINT("%sExpose " PIFMT " " PUFMT "\n",
- prefix,
- event->expose.x,
- event->expose.y,
- event->expose.width,
- event->expose.height);
- case PUGL_CLOSE:
- return PRINT("%sClose\n", prefix);
- case PUGL_MOTION:
- return PRINT("%sMouse motion at " PFFMT "\n",
- prefix,
- event->motion.x,
- event->motion.y);
- case PUGL_TIMER:
- return PRINT("%sTimer %" PRIuPTR "\n", prefix, event->timer.id);
- default:
- return PRINT("%sUnknown event type %d\n", prefix, (int)event->type);
- }
- }
-
-#undef PRINT
-#undef PUFMT
-#undef PIFMT
-#undef PFFMT
-
- return 0;
-}
-
-static inline const char*
-puglViewHintString(const PuglViewHint hint)
-{
- switch (hint) {
- case PUGL_CONTEXT_API:
- return "Context API";
- case PUGL_CONTEXT_VERSION_MAJOR:
- return "Context major version";
- case PUGL_CONTEXT_VERSION_MINOR:
- return "Context minor version";
- case PUGL_CONTEXT_PROFILE:
- return "Context profile";
- case PUGL_CONTEXT_DEBUG:
- return "Context debug";
- case PUGL_RED_BITS:
- return "Red bits";
- case PUGL_GREEN_BITS:
- return "Green bits";
- case PUGL_BLUE_BITS:
- return "Blue bits";
- case PUGL_ALPHA_BITS:
- return "Alpha bits";
- case PUGL_DEPTH_BITS:
- return "Depth bits";
- case PUGL_STENCIL_BITS:
- return "Stencil bits";
- case PUGL_SAMPLE_BUFFERS:
- return "Sample buffers";
- case PUGL_SAMPLES:
- return "Samples";
- case PUGL_DOUBLE_BUFFER:
- return "Double buffer";
- case PUGL_SWAP_INTERVAL:
- return "Swap interval";
- case PUGL_RESIZABLE:
- return "Resizable";
- case PUGL_IGNORE_KEY_REPEAT:
- return "Ignore key repeat";
- case PUGL_REFRESH_RATE:
- return "Refresh rate";
- case PUGL_VIEW_TYPE:
- return "View type";
- case PUGL_DARK_FRAME:
- return "Dark frame";
- }
-
- return "Unknown";
-}
-
-static inline void
-printViewHints(const PuglView* view)
-{
- for (unsigned i = 0; i < PUGL_NUM_VIEW_HINTS; ++i) {
- fprintf(stderr,
- "%s: %d\n",
- puglViewHintString((PuglViewHint)i),
- puglGetViewHint(view, (PuglViewHint)i));
- }
-}
-
-static inline void
-puglPrintTestUsage(const char* prog, const char* posHelp)
-{
- printf("Usage: %s [OPTION]... %s\n\n"
- " -E Use OpenGL ES\n"
- " -G OpenGL context version\n"
- " -a Enable anti-aliasing\n"
- " -b Block and only update on user input\n"
- " -d Directly draw to window (no double-buffering)\n"
- " -e Enable platform error-checking\n"
- " -f Fast drawing, explicitly disable vertical sync\n"
- " -h Display this help\n"
- " -i Ignore key repeat\n"
- " -v Print verbose output\n"
- " -r Resizable window\n"
- " -s Explicitly enable vertical sync\n",
- prog,
- posHelp);
-}
-
-static inline PuglTestOptions
-puglParseTestOptions(int* pargc, char*** pargv)
-{
- PuglTestOptions opts = {
- 0,
- PUGL_TRUE,
- PUGL_DONT_CARE,
- PUGL_OPENGL_API,
- 3,
- 3,
- true,
- false,
- false,
- false,
- false,
- false,
- };
-
- char** const argv = *pargv;
- int i = 1;
- for (; i < *pargc; ++i) {
- if (!strcmp(argv[i], "-E")) {
- opts.glApi = PUGL_OPENGL_ES_API;
- } else if (!strcmp(argv[i], "-G")) {
- if (++i == *pargc) {
- fprintf(stderr, "error: Missing OpenGL version argument\n");
- return opts;
- }
-
- const int matches =
- sscanf(argv[i], "%d.%d", &opts.glMajorVersion, &opts.glMinorVersion);
- if (matches != 2) {
- fprintf(stderr, "error: Invalid OpenGL version argument\n");
- return opts;
- }
- } else if (!strcmp(argv[i], "-a")) {
- opts.samples = 4;
- } else if (!strcmp(argv[i], "-b")) {
- opts.continuous = false;
- } else if (!strcmp(argv[i], "-d")) {
- opts.doubleBuffer = PUGL_FALSE;
- } else if (!strcmp(argv[i], "-e")) {
- opts.errorChecking = PUGL_TRUE;
- } else if (!strcmp(argv[i], "-f")) {
- opts.sync = PUGL_FALSE;
- } else if (!strcmp(argv[i], "-h")) {
- opts.help = true;
- return opts;
- } else if (!strcmp(argv[i], "-i")) {
- opts.ignoreKeyRepeat = true;
- } else if (!strcmp(argv[i], "-r")) {
- opts.resizable = true;
- } else if (!strcmp(argv[i], "-s")) {
- opts.sync = PUGL_TRUE;
- } else if (!strcmp(argv[i], "-v")) {
- opts.verbose = true;
- } else if (argv[i][0] != '-') {
- break;
- } else {
- opts.help = true;
- logError("Unknown option: %s\n", argv[i]);
- }
- }
-
- *pargc -= i;
- *pargv += i;
-
- return opts;
-}
-
-#endif // TEST_TEST_UTILS_H
diff --git a/test/test_view.c b/test/test_view.c
index a6af9f2..08e5255 100644
--- a/test/test_view.c
+++ b/test/test_view.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/stub.h"
+#include <pugl/pugl.h>
+#include <pugl/stub.h>
#include <assert.h>
#include <stdbool.h>
@@ -73,7 +73,7 @@ main(int argc, char** argv)
puglSetHandle(test.view, &test);
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 384, 640);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 384, 640);
// Check basic accessors
assert(puglGetBackend(test.view) == puglStubBackend());
diff --git a/test/test_vulkan.c b/test/test_vulkan.c
index 3a7c612..258f978 100644
--- a/test/test_vulkan.c
+++ b/test/test_vulkan.c
@@ -5,10 +5,10 @@
#undef NDEBUG
-#include "test_utils.h"
+#include <puglutil/test_utils.h>
-#include "pugl/pugl.h"
-#include "pugl/vulkan.h"
+#include <pugl/pugl.h>
+#include <pugl/vulkan.h>
#include <vulkan/vulkan_core.h>
@@ -172,7 +172,7 @@ main(int argc, char** argv)
puglSetBackend(test.view, puglVulkanBackend());
puglSetEventFunc(test.view, onEvent);
puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256);
- puglSetPosition(test.view, 640, 640);
+ puglSetPositionHint(test.view, PUGL_DEFAULT_POSITION, 640, 640);
assert(!puglRealize(test.view));
// Create Vulkan surface for window
diff --git a/test/test_world.c b/test/test_world.c
index 18c8ef2..9d0d145 100644
--- a/test/test_world.c
+++ b/test/test_world.c
@@ -5,7 +5,7 @@
#undef NDEBUG
-#include "pugl/pugl.h"
+#include <pugl/pugl.h>
#include <assert.h>
#include <stdint.h>