summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2023-03-18 14:56:15 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2023-03-18 15:42:10 +0100
commitfb32ee2de2dab1411446b57c2ce86c8be1a13704 (patch)
treed86cfabfd25650064354eb8355a998c40f6e7e5f /src
parentbccebed360cb8208602478c0af2351455bafa69f (diff)
Add a desktop action to run the unit tests
Diffstat (limited to 'src')
-rw-r--r--src/adwaita/disfluid-application.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/adwaita/disfluid-application.c b/src/adwaita/disfluid-application.c
index b15d6c6..9afe838 100644
--- a/src/adwaita/disfluid-application.c
+++ b/src/adwaita/disfluid-application.c
@@ -24,6 +24,7 @@ struct _DisfluidAdwApplication
{
AdwApplication parent_instance;
gboolean only_show_version;
+ gboolean only_run_tests;
gint n_tests_run;
gint n_tests_errors;
gchar *tests_output;
@@ -71,6 +72,7 @@ disfluid_adw_application_init (DisfluidAdwApplication * self)
(void) self;
/* Perform default initialization of self. */
self->only_show_version = false;
+ self->only_run_tests = false;
self->n_tests_run = -1;
self->n_tests_errors = -1;
self->tests_output = NULL;
@@ -92,6 +94,13 @@ disfluid_adw_application_init (DisfluidAdwApplication * self)
.arg_data = &(self->only_show_version),
.description = N_("Show the program version.")},
{
+ .long_name = N_("run-tests"),
+ .short_name = 'T',
+ .flags = G_OPTION_FLAG_NONE,
+ .arg = G_OPTION_ARG_NONE,
+ .arg_data = &(self->only_run_tests),
+ .description = N_("Run the unit tests and exit.")},
+ {
.long_name = N_("n-tests-run"),
.flags = G_OPTION_FLAG_NONE,
.arg = G_OPTION_ARG_INT,
@@ -142,6 +151,10 @@ activated (GtkApplication * app)
{
launch_about_window (NULL, NULL, app);
}
+ else if (self->only_run_tests)
+ {
+ start_tests (NULL, NULL, app);
+ }
else if (self->n_tests_run >= 0 || self->n_tests_errors >= 0
|| self->tests_output != NULL)
{