forked from AuroraMiddleware/gtk
6b096e5c5b
The tooltip handling in GtkWidget is "special": - the string is stored inside the qdata instead of the private instance data - the accessors call g_object_set() and g_object_get(), and the logic is all inside the property implementation, instead of being the other way around - the getters return a copy of the string - the setters don't really notify all the involved properties The GtkWidgetAccessible uses the (escaped) tooltip text as a source for the accessible object description, which means it has to store the tooltip inside the object qdata, and update its copy at construction and property notification time. We can simplify this whole circus by making the tooltip properties (text and markup) more idiomatic: - notify all side-effect properties - return a constant string from the getter - if tooltip-text is set: - store the text as is - escape the markup and store it separately for the markup getter - if tooltip-markup is set: - store the markup as is - parse the markup and store it separately for the text getter The part of the testtooltips interactive test that checks that the getters are doing the right thing is now part of the gtk testsuite, so we ensure we don't regress in behaviour.
230 lines
6.6 KiB
Meson
230 lines
6.6 KiB
Meson
testexecdir = join_paths(installed_test_bindir, 'gtk')
|
|
testdatadir = join_paths(installed_test_datadir, 'gtk')
|
|
|
|
gtk_tests_export_dynamic_ldflag = []
|
|
|
|
if cc.get_id() != 'msvc'
|
|
gtk_tests_export_dynamic_ldflag = ['-Wl,--export-dynamic']
|
|
endif
|
|
|
|
tests = [
|
|
['accel'],
|
|
['accessible'],
|
|
['action'],
|
|
['adjustment'],
|
|
['bitmask', ['../../gtk/gtkallocatedbitmask.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']],
|
|
['builder', [], [], gtk_tests_export_dynamic_ldflag],
|
|
['builderparser'],
|
|
['cellarea'],
|
|
['check-icon-names'],
|
|
['constraint-solver', [
|
|
'../../gtk/gtkconstraintsolver.c',
|
|
'../../gtk/gtkconstraintexpression.c',
|
|
], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']
|
|
],
|
|
['cssprovider'],
|
|
['rbtree-crash', ['../../gtk/gtkrbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']],
|
|
['defaultvalue'],
|
|
['entry'],
|
|
['expression'],
|
|
['filter'],
|
|
['filterlistmodel'],
|
|
['flattenlistmodel'],
|
|
['floating'],
|
|
['flowbox'],
|
|
#['gestures'],
|
|
['grid'],
|
|
['grid-layout'],
|
|
['icontheme'],
|
|
['listbox'],
|
|
['main'],
|
|
['maplistmodel'],
|
|
['multiselection'],
|
|
['notify'],
|
|
['no-gtk-init'],
|
|
['object'],
|
|
['objects-finalize'],
|
|
['papersize'],
|
|
#['popover'],
|
|
['propertylookuplistmodel', ['../../gtk/gtkpropertylookuplistmodel.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']],
|
|
['rbtree', ['../../gtk/gtktreerbtree.c'], ['-DGTK_COMPILATION', '-UG_ENABLE_DEBUG']],
|
|
['recentmanager'],
|
|
['regression-tests'],
|
|
['scrolledwindow'],
|
|
['searchbar'],
|
|
['shortcuts'],
|
|
['singleselection'],
|
|
['slicelistmodel'],
|
|
['sorter'],
|
|
['sortlistmodel'],
|
|
['spinbutton'],
|
|
['templates'],
|
|
['textbuffer'],
|
|
['textiter'],
|
|
['theme-validate'],
|
|
['tooltips'],
|
|
['treelistmodel'],
|
|
['treemodel', ['treemodel.c', 'liststore.c', 'treestore.c', 'filtermodel.c',
|
|
'modelrefcount.c', 'sortmodel.c', 'gtktreemodelrefcount.c']],
|
|
['treepath'],
|
|
['treesorter'],
|
|
['treeview'],
|
|
['typename'],
|
|
['displayclose'],
|
|
['revealer-size'],
|
|
['widgetorder'],
|
|
['widget-refcount'],
|
|
]
|
|
|
|
# Tests that are expected to fail
|
|
xfail = [
|
|
# one of the window resizing tests fails after
|
|
# the GdkToplevel refactoring, and needs a big
|
|
# gtkwindow.c configure request cleanup
|
|
'window',
|
|
]
|
|
|
|
is_debug = get_option('buildtype').startswith('debug')
|
|
|
|
test_cargs = []
|
|
|
|
if os_unix
|
|
# tests += [['defaultvalue']] # disabled in Makefile.am as well
|
|
test_cargs += ['-DHAVE_UNIX_PRINT_WIDGETS']
|
|
endif
|
|
|
|
foreach flag: common_cflags
|
|
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
|
|
test_cargs += flag
|
|
endif
|
|
endforeach
|
|
|
|
foreach t : tests
|
|
test_name = t.get(0)
|
|
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
|
|
test_extra_cargs = t.get(2, [])
|
|
test_extra_ldflags = t.get(3, [])
|
|
|
|
test_exe = executable(test_name, test_srcs,
|
|
c_args : test_cargs + test_extra_cargs,
|
|
link_args : test_extra_ldflags,
|
|
dependencies : libgtk_dep,
|
|
install: get_option('install-tests'),
|
|
install_dir: testexecdir)
|
|
|
|
expect_fail = xfail.contains(test_name)
|
|
|
|
test(test_name, test_exe,
|
|
args: [ '--tap', '-k' ],
|
|
protocol: 'tap',
|
|
env: [
|
|
'NO_AT_BRIDGE=1',
|
|
'GSK_RENDERER=cairo',
|
|
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
|
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
|
],
|
|
suite: 'gtk',
|
|
should_fail: expect_fail,
|
|
)
|
|
endforeach
|
|
|
|
# FIXME: if objc autotestkeywords_CPPFLAGS += -DHAVE_OBJC=1 -x objective-c++
|
|
if add_languages('cpp', required: false)
|
|
test_exe = executable('autotestkeywords',
|
|
'autotestkeywords.cc',
|
|
c_args : test_cargs + ['-Idummy-headers'],
|
|
dependencies : libgtk_dep,
|
|
install: get_option('install-tests'),
|
|
install_dir: testexecdir)
|
|
test('c++ keywords', 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: 'gtk')
|
|
if get_option('install-tests')
|
|
conf = configuration_data()
|
|
conf.set('testexecdir', testexecdir)
|
|
conf.set('test', 'autotestkeywords')
|
|
configure_file(input: 'gtk.test.in',
|
|
output: 'autotestkeywords.test',
|
|
configuration: conf,
|
|
install_dir: testdatadir)
|
|
endif
|
|
endif
|
|
|
|
|
|
focus_chain_tests = [
|
|
# test direction
|
|
[ 'basic', 'tab' ],
|
|
[ 'basic', 'tab-backward' ],
|
|
[ 'basic', 'left' ],
|
|
[ 'basic', 'right' ],
|
|
[ 'widget-factory', 'tab' ],
|
|
[ 'widget-factory', 'tab-backward' ],
|
|
[ 'widget-factory', 'up' ],
|
|
[ 'widget-factory', 'down' ],
|
|
[ 'widget-factory', 'left' ],
|
|
[ 'widget-factory', 'right' ],
|
|
[ 'widget-factory2', 'tab' ],
|
|
[ 'widget-factory2', 'tab-backward' ],
|
|
# in ci, we don't show a color picker, so the focus chain
|
|
# for page3 is missing an expected button in the color editor
|
|
#[ 'widget-factory3', 'tab' ],
|
|
#[ 'widget-factory3', 'tab-backward' ],
|
|
]
|
|
|
|
focus_chain = executable(
|
|
'test-focus-chain',
|
|
['test-focus-chain.c'],
|
|
dependencies: libgtk_dep,
|
|
c_args: common_cflags,
|
|
install: get_option('install-tests'),
|
|
install_dir: testexecdir
|
|
)
|
|
|
|
foreach test : focus_chain_tests
|
|
test(test[0] + ' ' + test[1], focus_chain,
|
|
args: [ join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.ui'),
|
|
join_paths(meson.current_source_dir(), 'focus-chain', test[0] + '.' + test[1]) ],
|
|
env: [
|
|
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
|
|
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
|
|
],
|
|
suite: [ 'gtk', 'focus' ])
|
|
endforeach
|
|
|
|
|
|
if get_option('install-tests')
|
|
foreach t : tests
|
|
test_name = t.get(0)
|
|
conf = configuration_data()
|
|
conf.set('testexecdir', testexecdir)
|
|
conf.set('test', test_name)
|
|
configure_file(input: 'gtk.test.in',
|
|
output: '@0@.test'.format(test_name),
|
|
configuration: conf,
|
|
install_dir: testdatadir)
|
|
endforeach
|
|
|
|
install_subdir('icons', install_dir: testexecdir)
|
|
install_subdir('ui', install_dir: testexecdir)
|
|
|
|
endif
|
|
|
|
if false and get_option ('profiler')
|
|
|
|
test('performance-layout', test_performance,
|
|
args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
|
env: [ 'GTK_THEME=Empty' ],
|
|
suite: [ 'gtk' ])
|
|
|
|
test('performance-snapshot', test_performance,
|
|
args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
|
env: [ 'GTK_THEME=Empty' ],
|
|
suite: [ 'gtk' ])
|
|
|
|
endif
|