Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions tests/TestCase.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
public abstract class Gala.TestCase : Object {
public delegate void TestMethod ();

public string name { get; construct; }

private GLib.TestSuite suite;

construct {
suite = new GLib.TestSuite (name);
suite = new GLib.TestSuite (get_type ().name ());
}

public int run (string[] args) {
Expand Down
8 changes: 0 additions & 8 deletions tests/lib/GestureControllerTest.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ public class Gala.GestureControllerTest : MutterTestCase {
private GestureController controller;
private MockTarget target;

public GestureControllerTest () {
Object (name: "GestureControllerTest");
}

construct {
add_test ("Test basic propagation", test_basic_propagation);
add_test ("Test two immediate gotos", test_two_immediate_gotos);
Expand Down Expand Up @@ -201,7 +197,3 @@ public class Gala.GestureControllerTest : MutterTestCase {
run_main_loop ();
}
}

public int main (string[] args) {
return new Gala.GestureControllerTest ().run (args);
}
36 changes: 36 additions & 0 deletions tests/lib/Main.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2026 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*/

namespace Gala {
public int main (string[] args) {
var test_name = args[1];

var test_case = get_test_case (test_name);

if (test_case == null) {
warning ("TestCase %s not found", test_name);
return 1;
}

return test_case.run (args);
}

private TestCase? get_test_case (string name) {
Type[] test_types = {
typeof (GestureControllerTest),
typeof (PropertyTargetTest),
typeof (SetupTest),
typeof (SwipeTriggerTest),
};

foreach (var type in test_types) {
if (type.name () == name) {
return (TestCase) Object.new (type);
}
}

return null;
}
Comment thread
leolost2605 marked this conversation as resolved.
}
8 changes: 0 additions & 8 deletions tests/lib/PropertyTargetTest.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ public class Gala.PropertyTargetTest : TestCase {
private MockObject? target;
private PropertyTarget? default_int_prop_target;

public PropertyTargetTest () {
Object (name: "PropertyTarget");
}

construct {
add_test ("simple propagation", test_simple_propagation);
add_test ("double propagation", test_double_propagation);
Expand Down Expand Up @@ -151,7 +147,3 @@ public class Gala.PropertyTargetTest : TestCase {
assert_finalize_object<MockObject> (ref target);
}
}

public int main (string[] args) {
return new Gala.PropertyTargetTest ().run (args);
}
8 changes: 0 additions & 8 deletions tests/lib/SetupTest.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
* and allows us to interact with it, e.g. by creating a Clutter actor.
*/
public class Gala.SetupTest : MutterTestCase {
public SetupTest () {
Object (name: "SetupTest");
}

construct {
add_test ("Test setup successful", test_setup_successful);
add_test ("Test main loop", test_main_loop);
Expand Down Expand Up @@ -88,7 +84,3 @@ public class Gala.SetupTest : MutterTestCase {
assert_cmpint (frames, GT, 0);
}
}

public int main (string[] args) {
return new Gala.SetupTest ().run (args);
}
8 changes: 0 additions & 8 deletions tests/lib/SwipeTriggerTest.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public class Gala.SwipeTriggerTest : MutterTestCase {
private Clutter.Actor? actor;
private SwipeTrigger? trigger;

public SwipeTriggerTest () {
Object (name: "SwipeTriggerTest");
}

construct {
add_test ("Test finalize trigger first", test_finalize_trigger_first);
add_test ("Test finalize actor first", test_finalize_actor_first);
Expand Down Expand Up @@ -56,7 +52,3 @@ public class Gala.SwipeTriggerTest : MutterTestCase {
assert_finalize_object (ref trigger);
}
}

public int main (string[] args) {
return new Gala.SwipeTriggerTest ().run (args);
}
29 changes: 20 additions & 9 deletions tests/lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,26 @@ tests = [
'SwipeTriggerTest',
]

test_sources = []
foreach test : tests
test_executable = executable(
test,
'@0@.vala'.format(test),
common_test_sources,
gala_lib_sources,
dependencies: gala_base_dep,
install: false,
)
test_sources += test + '.vala'
endforeach

lib_test_sources = [
'Main.vala'
]

test(test, test_executable, suite: ['Gala', 'Gala/lib'], is_parallel: false)
test_executable = executable(
'io.elementary.gala.tests',
common_test_sources,
lib_test_sources,
test_sources,
gala_lib_sources,
dependencies: gala_base_dep,
install: false,
)

foreach test : tests
test(test, test_executable, args: 'Gala' + test, suite: ['Gala', 'Gala/lib'], is_parallel: false)
endforeach