tests: Split client and JS tests

This gives each suite a longer time and keeps things separate.

Suggested in https://gitlab.gnome.org/GNOME/geary/-/merge_requests/670
This commit is contained in:
Guido Günther 2021-02-24 14:58:58 +01:00
parent fe30e49b74
commit fb3642149a
3 changed files with 103 additions and 7 deletions

View file

@ -101,6 +101,20 @@ test_client_sources = [
geary_resources
]
test_js_sources = [
'test-case.vala',
'test-js.vala',
'client/components/components-web-view-test-case.vala',
'js/components-page-state-test.vala',
'js/composer-page-state-test.vala',
'js/conversation-page-state-test.vala',
geary_compiled_schema,
geary_resources
]
test_integration_sources = [
'test-case.vala',
'test-integration.vala',
@ -151,6 +165,21 @@ test_client_bin = executable('test-client',
build_rpath: client_build_dir,
)
test_js_dependencies = [
client_internal_dep,
vala_unit_dep,
]
test_js_dependencies += client_dependencies
test_js_bin = executable('test-js',
test_js_sources + libmock_sources,
dependencies: test_js_dependencies,
include_directories: config_h_dir,
vala_args: geary_vala_args,
c_args: geary_c_args,
build_rpath: client_build_dir,
)
# Integration tests
test_integration_bin = executable('test-integration',
@ -178,3 +207,8 @@ test(
test_client_bin,
depends: [ client_lib, web_process ]
)
test(
'js-tests',
test_js_bin,
depends: [ client_lib, web_process ]
)

View file

@ -62,18 +62,11 @@ int main(string[] args) {
client.add_suite(new Util.Email.Test().suite);
client.add_suite(new Util.JS.Test().suite);
TestSuite js = new TestSuite("js");
js.add_suite(new Components.PageStateTest().suite);
js.add_suite(new Composer.PageStateTest().suite);
js.add_suite(new ConversationPageStateTest().suite);
/*
* Run the tests
*/
TestSuite root = TestSuite.get_root();
root.add_suite(client);
root.add_suite(js);
int ret = -1;
Idle.add(() => {

69
test/test-js.vala Normal file
View file

@ -0,0 +1,69 @@
/*
* Copyright 2016-2017 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
int main(string[] args) {
/*
* Set env vars right up front to avoid weird bugs
*/
// Use the memory GSettings DB so we a) always start with default
// values, and b) don't persist any changes made during a test
Environment.set_variable("GSETTINGS_BACKEND", "memory", true);
// Let GSettings know where to find the dev schema
Environment.set_variable("GSETTINGS_SCHEMA_DIR", _GSETTINGS_DIR, true);
/*
* Initialise all the things.
*/
// Ensure things like e.g. GLib's formatting routines uses a
// well-known UTF-8-based locale rather ASCII. Would like to use
// C.UTF-8 here, but currently only Debian et al and Fedora ship
// it, and as of Fedora 32 they disagree on collation order for
// non-ASCII chars.
GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8");
Gtk.init(ref args);
Test.init(ref args);
IconFactory.init(GLib.File.new_for_path(_SOURCE_ROOT_DIR));
Geary.RFC822.init();
Geary.HTML.init();
Geary.Logging.init();
if (GLib.Test.verbose()) {
GLib.Log.set_writer_func(Geary.Logging.default_log_writer);
Geary.Logging.log_to(GLib.stdout);
}
/*
* Hook up all tests into appropriate suites
*/
TestSuite js = new TestSuite("js");
js.add_suite(new Components.PageStateTest().suite);
js.add_suite(new Composer.PageStateTest().suite);
js.add_suite(new ConversationPageStateTest().suite);
/*
* Run the tests
*/
TestSuite root = TestSuite.get_root();
root.add_suite(js);
int ret = -1;
Idle.add(() => {
ret = Test.run();
Gtk.main_quit();
return false;
});
Gtk.main();
return ret;
}