[gtk+/wip/matthiasc/calendar: 2/2] Add a datechooser test



commit 3531125982daf272cbb83dd030df8a51693345b0
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 31 00:49:21 2015 -0400

    Add a datechooser test

 tests/Makefile.am       |    4 +++
 tests/testdatechooser.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 50f2986..e7deb94 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -168,6 +168,7 @@ noinst_PROGRAMS =  $(TEST_PROGS)    \
        testpopover                     \
        gdkgears                        \
        listmodel                       \
+       testdatechooser                 \
        $(NULL)
 
 if USE_X11
@@ -308,6 +309,7 @@ testrevealer_DEPENDENCIES = $(TEST_DEPS)
 testtitlebar_DEPENDENCIES = $(TEST_DEPS)
 testwindowsize_DEPENDENCIES = $(TEST_DEPS)
 listmodel_DEPENDENCIES = $(TEST_DEPS)
+testdatechooser_DEPENDENCIES = $(TEST_DEPS)
 
 animated_resizing_SOURCES =    \
        animated-resizing.c     \
@@ -542,6 +544,8 @@ testglblending_SOURCES =    \
 
 listmodel_SOURCES = listmodel.c
 
+testdatechooser_SOURCES = testdatechooser.c
+
 EXTRA_DIST +=                  \
        gradient1.png           \
        testgtk.1               \
diff --git a/tests/testdatechooser.c b/tests/testdatechooser.c
new file mode 100644
index 0000000..e6e3da5
--- /dev/null
+++ b/tests/testdatechooser.c
@@ -0,0 +1,54 @@
+#include <gtk/gtk.h>
+
+static const gchar css[] =
+".weekday {"
+"  background: darkgray;"
+"  padding-left: 6px;"
+"  padding-right: 6px;"
+"}"
+".weeknum {"
+"  background: darkgray;"
+"  padding-top: 6px;"
+"  padding-bottom: 6px;"
+"}"
+".day {"
+"  margin: 6px;"
+"}"
+".day.other-month {"
+"  color: gray;"
+"}"
+".day:selected {"
+"  background: @theme_selected_bg_color;"
+"}";
+
+int
+main (int argc, char *argv[])
+{
+  GtkWidget *window, *calendar;
+  GtkCssProvider *provider;
+  GError *error = NULL;
+
+  gtk_init (NULL, NULL);
+
+  provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_data (provider, css, sizeof (css), &error);
+  if (error)
+    {
+      g_print ("%s", error->message);
+      g_error_free (error);
+    }
+  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                             GTK_STYLE_PROVIDER (provider), 800);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+  calendar = gtk_date_chooser_widget_new ();
+
+  gtk_container_add (GTK_CONTAINER (window), calendar);
+
+  gtk_widget_show_all (window);
+
+  gtk_main ();
+
+  return 0;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]