>From b0ee69086912223e2027ecb0879e9fc4fe40cc08 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofour...@redhat.com>
Date: Fri, 30 Nov 2012 10:01:34 +0100
Subject: [PATCH 2/3] test: add check for leaders and ring circular motion

Check for the presence of the leaders in the SVG layouts and
changes the naming of touch ring control to CW and CCW in
place of "Up" and "Down".

Signed-off-by: Olivier Fourdan <ofour...@redhat.com>
---
 test/tablet-svg-validity.c |   85 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 78 insertions(+), 7 deletions(-)

diff --git a/test/tablet-svg-validity.c b/test/tablet-svg-validity.c
index 0dca5a4..4e3cc81 100644
--- a/test/tablet-svg-validity.c
+++ b/test/tablet-svg-validity.c
@@ -1,5 +1,5 @@
 /*
- * Copyright ?? 2012 Red Hat, Inc.
+ * Copyright © 2012 Red Hat, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
@@ -127,7 +127,7 @@ check_button (xmlNodePtr cur, WacomDevice *device, char button, gchar *type)
 }
 
 static void
-check_touch (xmlNodePtr cur, gchar *id, gchar *type)
+check_touchstrip (xmlNodePtr cur, gchar *id)
 {
 	char             *sub;
 	char             *class;
@@ -136,7 +136,7 @@ check_touch (xmlNodePtr cur, gchar *id, gchar *type)
 	node = verify_has_sub (cur, id);
 	g_assert (node != NULL);
 
-	class = g_strdup_printf ("%s %s", id, type);
+	class = g_strdup_printf ("%s %s", id, "TouchStrip");
 	verify_has_class (node, class);
 	g_free (class);
 
@@ -157,6 +157,76 @@ check_touch (xmlNodePtr cur, gchar *id, gchar *type)
 	class = g_strdup_printf ("%sDown %s Label", id, id);
 	verify_has_class (node, class);
 	g_free (class);
+
+	sub = g_strdup_printf ("Leader%sUp", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sUp %s Leader", id, id);
+	verify_has_class (node, class);
+	g_free (class);
+
+	sub = g_strdup_printf ("Leader%sDown", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sDown %s Leader", id, id);
+	verify_has_class (node, class);
+	g_free (class);
+}
+
+
+static void
+check_touchring (xmlNodePtr cur, gchar *id)
+{
+	char             *sub;
+	char             *class;
+	xmlNodePtr        node;
+
+	node = verify_has_sub (cur, id);
+	g_assert (node != NULL);
+
+	class = g_strdup_printf ("%s %s", id, "TouchRing");
+	verify_has_class (node, class);
+	g_free (class);
+
+	sub = g_strdup_printf ("Label%sCCW", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sCCW %s Label", id, id);
+	verify_has_class (node, class);
+	g_free (class);
+
+	sub = g_strdup_printf ("Label%sCW", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sCW %s Label", id, id);
+	verify_has_class (node, class);
+	g_free (class);
+
+	sub = g_strdup_printf ("Leader%sCCW", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sCCW %s Leader", id, id);
+	verify_has_class (node, class);
+	g_free (class);
+
+	sub = g_strdup_printf ("Leader%sCW", id);
+	node = verify_has_sub (cur, sub);
+	g_assert (node != NULL);
+	g_free (sub);
+
+	class = g_strdup_printf ("%sCW %s Leader", id, id);
+	verify_has_class (node, class);
+	g_free (class);
 }
 
 static void
@@ -203,18 +273,19 @@ verify_tablet_layout (WacomDeviceDatabase *db, WacomDevice *device)
 	for (button = 'A'; button < 'A' + num_buttons; button++) {
 		check_button (cur, device, button, "Button");
 		check_button (cur, device, button, "Label");
+		check_button (cur, device, button, "Leader");
 	}
 
 	/* Touch rings */
 	if (libwacom_has_ring(device))
-		check_touch (cur, "Ring", "TouchRing");
+		check_touchring (cur, "Ring");
 	if (libwacom_has_ring2(device))
-		check_touch (cur, "Ring2", "TouchRing");
+		check_touchring (cur, "Ring2");
 	/* Touch strips */
 	if (libwacom_get_num_strips(device) > 0)
-		check_touch (cur, "Strip", "TouchStrip");
+		check_touchstrip (cur, "Strip");
 	if (libwacom_get_num_strips(device) > 1)
-		check_touch (cur, "Strip2", "TouchStrip");
+		check_touchstrip (cur, "Strip2");
 
 	xmlFreeDoc(doc);
 
-- 
1.7.1

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to