Adapt vala-unit and tests to GLib 2.70 and later

`GLib.TestSuite` is a special type of object, as it doesn't actually
have an associated copy function or a reference/unreference function.
In practice, that actually means there's no way to actually have 2
strong references to such an object, or to copy it somehow. Due to the
way GObject properties in Vala work, that means you can't really use
them either.

Ever since vala commit 5f0a146f65, this got reflected properly in the
internally maintained GLib VAPI (as people were experiencing double
frees otherwise), but it was added only conditionally for GLib 2.70 or
later. In practice, that means you only get vala compiler issues if you
(impliclty) set `--target-glib=2.70` (or a later version).

To fix this for vala-unit and our own Geary tests, this commit changes
the `ValaUnit.TestCase` class to only allow "stealing" the strong
reference to the `GLib.TestSuite`, rather than somehowing allowing
people to hold a weak reference, and by also making it a protected field
rather than a property.

Since this changes the API of ValaUnit, we also bump the version. In
general though, I hope people aren't using ValaUnit externally, since
these types of API/ABI breaks can happen with Vala libraries.

Link: 5f0a146f65
This commit is contained in:
Niels De Graef 2025-12-07 10:09:15 +01:00
parent 6ce2373a75
commit 81859bd3c3
10 changed files with 98 additions and 85 deletions

View file

@ -126,6 +126,7 @@ test_integration_sources = [
test_engine_dependencies = [
config_dep,
glib,
engine_internal_dep,
vala_unit_dep,
]
@ -151,6 +152,7 @@ test_engine_bin = executable('test-engine',
test_client_dependencies = [
config_dep,
glib,
client_internal_dep,
vala_unit_dep,
]
@ -166,6 +168,7 @@ test_client_bin = executable('test-client',
test_js_dependencies = [
config_dep,
glib,
client_internal_dep,
vala_unit_dep,
]
@ -185,6 +188,7 @@ test_integration_bin = executable('test-integration',
test_integration_sources,
dependencies: [
config_dep,
glib,
engine_dep,
gee,
gio,