[gnome-control-center] datetime: Add test application for missing TZ pixmaps
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] datetime: Add test application for missing TZ pixmaps
- Date: Wed, 29 Sep 2010 12:28:58 +0000 (UTC)
commit 2baa0fcfd023fa4de69b913a06d250c9664f801b
Author: Bastien Nocera <hadess hadess net>
Date: Wed Sep 29 13:28:17 2010 +0100
datetime: Add test application for missing TZ pixmaps
https://bugzilla.gnome.org/show_bug.cgi?id=630261
panels/datetime/Makefile.am | 12 ++++++++++
panels/datetime/test-timezone.c | 47 +++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/panels/datetime/Makefile.am b/panels/datetime/Makefile.am
index 70fa618..af76140 100644
--- a/panels/datetime/Makefile.am
+++ b/panels/datetime/Makefile.am
@@ -68,6 +68,18 @@ INCLUDES = \
-DDATADIR="\"$(uidir)\"" \
$(NULL)
+noinst_PROGRAMS = test-timezone
+
+test_timezone_SOURCES = test-timezone.c tz.c tz.h
+test_timezone_LDADD = $(PANEL_LIBS)
+test_timezone_CFLAGS = $(PANEL_CFLAGS)
+
+all: check
+
+check: test-timezone
+ # FIXME remove "|| :" when we have all the necessary pixmaps
+ $(builddir)/test-timezone $(srcdir)/data || :
+
ccpanelsdir = $(PANELS_DIR)
ccpanels_LTLIBRARIES = libdate_time.la
diff --git a/panels/datetime/test-timezone.c b/panels/datetime/test-timezone.c
new file mode 100644
index 0000000..2f3f17c
--- /dev/null
+++ b/panels/datetime/test-timezone.c
@@ -0,0 +1,47 @@
+#include "tz.h"
+
+int main (int argc, char **argv)
+{
+ TzDB *db;
+ GPtrArray *locs;
+ guint i;
+ char *pixmap_dir;
+ int retval = 0;
+
+ if (argc == 2) {
+ pixmap_dir = g_strdup (argv[1]);
+ } else if (argc == 1) {
+ pixmap_dir = g_strdup ("data/");
+ } else {
+ g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]);
+ return 1;
+ }
+
+ db = tz_load_db ();
+ locs = tz_get_locations (db);
+ for (i = 0; i < locs->len ; i++) {
+ TzLocation *loc = locs->pdata[i];
+ TzInfo *info;
+ char *filename, *path;
+ gdouble selected_offset;
+
+ info = tz_info_from_location (loc);
+ selected_offset = tz_location_get_utc_offset (loc)
+ / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
+
+ filename = g_strdup_printf ("timezone_%g.png", selected_offset);
+ path = g_build_filename (pixmap_dir, filename, NULL);
+
+ if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE) {
+ g_message ("File '%s' missing for zone '%s'", filename, loc->zone);
+ retval = 1;
+ }
+
+ g_free (filename);
+ g_free (path);
+ }
+ tz_db_free (db);
+ g_free (pixmap_dir);
+
+ return retval;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]