Split test running up into test-engine and test-client.
This allows us to compile the engine tests against the internal VAPI, so we can unit test internal classes. * CMakeLists.txt: Add top-level targets test-engine-run and test-client-run that execute the respective test binaries. Make the tests target depend on them and make them depend on their binaries. * Makefile.in: Add test-client and test-engin targets for convenience. * src/CMakeLists.txt: Make the right invocation of valac to generate a correct geary-engine-internal.vapi. Make gsettings schema generation depend on geary-client so it exists for test-client if the main binary hasn't been built. * test/CMakeLists.txt: Split everything up into to builds, one for test-engine and the other for test-client. Use geary-engine-internal when building test-engine for access to internal classes and members. * test/engine/util-idle-manager-test.vala, test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather than the GTK main loop for pumping events so the test cases compile without GTK. * test/test-engine.vala, test/test-client.vala: New main source file for test binaries based on old main.vala.
This commit is contained in:
parent
9a83e95b89
commit
5ed7de55dd
8 changed files with 132 additions and 49 deletions
|
|
@ -29,10 +29,10 @@ class Geary.IdleManagerTest : Gee.TestCase {
|
|||
test.schedule();
|
||||
|
||||
// There should be at least one event pending
|
||||
assert(Gtk.events_pending());
|
||||
assert(this.main_loop.pending());
|
||||
|
||||
// Execute the idle function
|
||||
Gtk.main_iteration();
|
||||
this.main_loop.iteration(true);
|
||||
|
||||
assert(did_run);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Geary.TimeoutManagerTest : Gee.TestCase {
|
|||
|
||||
timer.start();
|
||||
while (test.is_running && timer.elapsed() < SECONDS_EPSILON) {
|
||||
Gtk.main_iteration();
|
||||
this.main_loop.iteration(true);
|
||||
}
|
||||
|
||||
assert_epsilon(timer.elapsed(), 1.0, SECONDS_EPSILON);
|
||||
|
|
@ -53,7 +53,7 @@ class Geary.TimeoutManagerTest : Gee.TestCase {
|
|||
|
||||
timer.start();
|
||||
while (test.is_running && timer.elapsed() < 100 + MILLISECONDS_EPSILON) {
|
||||
Gtk.main_iteration();
|
||||
this.main_loop.iteration(true);
|
||||
}
|
||||
|
||||
assert_epsilon(timer.elapsed(), 0.1, MILLISECONDS_EPSILON);
|
||||
|
|
@ -69,7 +69,7 @@ class Geary.TimeoutManagerTest : Gee.TestCase {
|
|||
|
||||
timer.start();
|
||||
while (count < 2 && timer.elapsed() < SECONDS_EPSILON * 2) {
|
||||
Gtk.main_iteration();
|
||||
this.main_loop.iteration(true);
|
||||
}
|
||||
timer.stop();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue