summaryrefslogtreecommitdiff
path: root/src/adwaita/disfluid-tests-results.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/adwaita/disfluid-tests-results.c')
-rw-r--r--src/adwaita/disfluid-tests-results.c108
1 files changed, 0 insertions, 108 deletions
diff --git a/src/adwaita/disfluid-tests-results.c b/src/adwaita/disfluid-tests-results.c
deleted file mode 100644
index f4794ef..0000000
--- a/src/adwaita/disfluid-tests-results.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include <config.h>
-
-#include "attribute.h"
-#include <disfluid.h>
-#include "disfluid-adwaita.h"
-
-#define STREQ(a, b) (strcmp ((a), (b)) == 0)
-#define STRNEQ(a, b) (! (STREQ (a, b)))
-
-#include <locale.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "gettext.h"
-#include "relocatable.h"
-
-#define _(String) dgettext (PACKAGE, (String))
-#define N_(String) (String)
-
-#include <adwaita.h>
-#include <gtk/gtk.h>
-
-void
-disfluid_adw_show_tests_results (GtkApplication * app,
- size_t n_tests,
- size_t n_errors, const char *output)
-{
- GtkTextBuffer *buffer = gtk_text_buffer_new (NULL);
- g_object_set (G_OBJECT (buffer), "text", output, NULL);
- GtkTextView *text_area =
- GTK_TEXT_VIEW (gtk_text_view_new_with_buffer (buffer));
- g_object_unref (buffer);
- g_object_set (G_OBJECT (text_area),
- "editable", (gboolean) 0,
- "hscroll-policy", GTK_SCROLL_NATURAL, NULL);
- char *icon_name = NULL;
- char *title = NULL;
- char *description = NULL;
- if (n_errors == 0)
- {
- icon_name = g_strdup ("dialog-information");
- if (asprintf
- (&title,
- dngettext (PACKAGE, "The %lu test passed", "All %lu tests passed",
- n_tests), n_tests) < 0)
- {
- title = NULL;
- }
- if (asprintf (&description, dngettext (PACKAGE, "\
-The unit test indicates that when you restart Experiences, \
-it will behave as expected.", "\
-The unit tests indicate that when you restart Experiences, \
-it will behave as expected.", n_tests)) < 0)
- {
- description = NULL;
- }
- }
- else
- {
- icon_name = g_strdup ("dialog-error");
- if (asprintf
- (&title,
- dngettext (PACKAGE, "A test failed", "Some tests failed",
- n_errors)) < 0)
- {
- title = NULL;
- }
- if (asprintf (&description,
- dngettext (PACKAGE,
- "%2$lu unit tests failed out of %1$lu.",
- "%2$lu unit tests failed out of %1$lu.",
- n_errors), n_tests, n_errors) < 0)
- {
- description = NULL;
- }
- }
- AdwStatusPage *page = ADW_STATUS_PAGE (g_object_new (ADW_TYPE_STATUS_PAGE,
- "child", text_area,
- "icon-name", icon_name,
- "title", title,
- "description",
- description,
- NULL));
- g_free (icon_name);
- free (title);
- free (description);
- AdwWindowTitle *window_title =
- ADW_WINDOW_TITLE (g_object_new (ADW_TYPE_WINDOW_TITLE,
- "title", _("Experiences"),
- "subtitle", _("Unit Tests Results"),
- NULL));
- AdwHeaderBar *header_bar =
- ADW_HEADER_BAR (g_object_new (ADW_TYPE_HEADER_BAR,
- "title-widget", GTK_WIDGET (window_title),
- "centering-policy",
- ADW_CENTERING_POLICY_STRICT,
- NULL));
- GtkBox *main_content = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
- gtk_box_append (main_content, GTK_WIDGET (header_bar));
- gtk_box_append (main_content, GTK_WIDGET (page));
- AdwApplicationWindow *window =
- (AdwApplicationWindow *) g_object_new (ADW_TYPE_APPLICATION_WINDOW,
- "application",
- GTK_APPLICATION (app),
- "content",
- GTK_WIDGET (main_content),
- NULL);
- gtk_window_present (GTK_WINDOW (window));
-}