2017-10-18 01:19:44 +00:00
|
|
|
testexecdir = join_paths(installed_test_bindir, 'gdk')
|
|
|
|
testdatadir = join_paths(installed_test_datadir, 'gdk')
|
|
|
|
|
2017-03-22 11:39:27 +00:00
|
|
|
tests = [
|
Add GdkArray
This is a scary idea where you #define a bunch of preprocessor values
and then #include "gdkarrayimpl.c" and end up with a dynamic array for
that data type.
See https://en.wikipedia.org/wiki/X_Macro for what's going on.
What are the advantages over using GArray or GPtrArray?
* It's typesafe
Because it works like C++ templates, we can use the actual type of
the object instead of having to use gpointer.
* It's one less indirection
instead of 2 indirections via self->array->data, this array is
embedded, so self->array is the actual data, and just one indirection
away. This is pretty irrelevant in general, but can be very noticable
in tight loops.
* It's all inline
Because the whole API is defined as static inline functions, the
compiler has full access to everything and can (and does) optimize
out unnecessary calls, thereby speeding up some operations quite
significantly, when full optimizations are enabled.
* It has more features
In particular preallocation allows for avoiding malloc() calls, which
can again speed up tight loops a lot.
But there's also splice(), which is very useful when used with
listmodels.
2020-07-02 15:23:09 +00:00
|
|
|
'array',
|
2017-03-22 11:39:27 +00:00
|
|
|
'cairo',
|
2020-06-22 20:36:22 +00:00
|
|
|
'clipboard',
|
2017-03-22 11:39:27 +00:00
|
|
|
'display',
|
|
|
|
'encoding',
|
|
|
|
'keysyms',
|
2018-03-12 04:12:54 +00:00
|
|
|
'memorytexture',
|
2017-03-22 11:39:27 +00:00
|
|
|
'rectangle',
|
|
|
|
'rgba',
|
|
|
|
'seat',
|
|
|
|
]
|
2016-08-21 16:01:14 +00:00
|
|
|
|
2017-03-22 11:39:27 +00:00
|
|
|
foreach t : tests
|
2017-10-18 01:19:44 +00:00
|
|
|
test_exe = executable(t, '@0@.c'.format(t),
|
2020-10-09 17:17:04 +00:00
|
|
|
c_args: common_cflags,
|
|
|
|
dependencies: libgtk_dep,
|
|
|
|
install: get_option('install-tests'),
|
|
|
|
install_dir: testexecdir,
|
|
|
|
)
|
2017-10-18 01:19:44 +00:00
|
|
|
|
|
|
|
test(t, test_exe,
|
2020-10-09 17:17:04 +00:00
|
|
|
args: [ '--tap', '-k' ],
|
|
|
|
protocol: 'tap',
|
|
|
|
env: [
|
|
|
|
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
|
|
|
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
|
|
|
],
|
|
|
|
suite: 'gdk',
|
|
|
|
)
|
2016-08-21 16:01:14 +00:00
|
|
|
|
2017-10-18 01:52:48 +00:00
|
|
|
if get_option('install-tests')
|
|
|
|
test_cdata = configuration_data()
|
|
|
|
test_cdata.set('testexecdir', testexecdir)
|
|
|
|
test_cdata.set('test', t)
|
|
|
|
configure_file(input: 'gdk.test.in',
|
2020-10-09 17:17:04 +00:00
|
|
|
output: '@0@.test'.format(t),
|
|
|
|
configuration: test_cdata,
|
|
|
|
install: true,
|
|
|
|
install_dir: testdatadir,
|
|
|
|
)
|
2017-10-18 01:52:48 +00:00
|
|
|
endif
|
|
|
|
endforeach
|