Add a datechooser test

This commit is contained in:
Matthias Clasen
2015-08-31 00:49:21 -04:00
parent 26ab45a3e0
commit 3531125982
2 changed files with 58 additions and 0 deletions

View File

@@ -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 \

54
tests/testdatechooser.c Normal file
View File

@@ -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;
}