forked from AuroraMiddleware/gtk
8bf8ac5076
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.
44 lines
1.2 KiB
Meson
44 lines
1.2 KiB
Meson
testexecdir = join_paths(installed_test_bindir, 'gdk')
|
|
testdatadir = join_paths(installed_test_datadir, 'gdk')
|
|
|
|
tests = [
|
|
'array',
|
|
'cairo',
|
|
'clipboard',
|
|
'display',
|
|
'encoding',
|
|
'keysyms',
|
|
'memorytexture',
|
|
'rectangle',
|
|
'rgba',
|
|
'seat',
|
|
]
|
|
|
|
foreach t : tests
|
|
test_exe = executable(t, '@0@.c'.format(t),
|
|
c_args: common_cflags,
|
|
dependencies: libgtk_dep,
|
|
install: get_option('install-tests'),
|
|
install_dir: testexecdir)
|
|
|
|
test(t, test_exe,
|
|
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')
|
|
|
|
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',
|
|
output: '@0@.test'.format(t),
|
|
configuration: test_cdata,
|
|
install: true,
|
|
install_dir: testdatadir)
|
|
endif
|
|
endforeach
|