[geary: 2/3] tests: Split client and JS tests
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 2/3] tests: Split client and JS tests
- Date: Mon, 26 Jul 2021 12:00:12 +0000 (UTC)
commit fb3642149a5f0bb17e139ff166c446de4e8e90fb
Author: Guido Günther <agx sigxcpu org>
Date: Wed Feb 24 14:58:58 2021 +0100
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
test/meson.build | 34 +++++++++++++++++++++++++
test/test-client.vala | 7 ------
test/test-js.vala | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 103 insertions(+), 7 deletions(-)
---
diff --git a/test/meson.build b/test/meson.build
index dd1ce6889..8adfd81a1 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -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 ]
+)
diff --git a/test/test-client.vala b/test/test-client.vala
index 08949b4ce..f93ddc927 100644
--- a/test/test-client.vala
+++ b/test/test-client.vala
@@ -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(() => {
diff --git a/test/test-js.vala b/test/test-js.vala
new file mode 100644
index 000000000..998ff10cb
--- /dev/null
+++ b/test/test-js.vala
@@ -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;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]