[gtk/matthiasc/css-change-tracking-4: 4/11] Add testcases for css change flags



commit 3136d15c0c34561c2c693c4c80010a3c50d888d9
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 16 20:04:00 2020 -0500

    Add testcases for css change flags

 testsuite/css/change/meson.build  |   3 +
 testsuite/css/change/simple.css   |   7 ++
 testsuite/css/change/simple.nodes |   5 +
 testsuite/css/change/simple.ui    |  26 +++++
 testsuite/css/change/test2.css    | 186 ++++++++++++++++++++++++++++++
 testsuite/css/change/test2.nodes  |  48 ++++++++
 testsuite/css/change/test2.ui     | 235 ++++++++++++++++++++++++++++++++++++++
 testsuite/css/change/test3.css    |  21 ++++
 testsuite/css/change/test3.nodes  |   5 +
 testsuite/css/change/test3.ui     |  26 +++++
 testsuite/css/meson.build         |   1 +
 11 files changed, 563 insertions(+)
---
diff --git a/testsuite/css/change/meson.build b/testsuite/css/change/meson.build
index f12c34d67f..8e9df3089b 100644
--- a/testsuite/css/change/meson.build
+++ b/testsuite/css/change/meson.build
@@ -20,6 +20,9 @@ test('change', test_change,
      suite: 'css')
 
 test_data = [
+  'test1.css', 'test1.ui', 'test1.nodes',
+  'test2.css', 'test2.ui', 'test2.nodes',
+  'test3.css', 'test3.ui', 'test3.nodes',
 ]
 
 if get_option('install-tests')
diff --git a/testsuite/css/change/simple.css b/testsuite/css/change/simple.css
new file mode 100644
index 0000000000..fb9f71f913
--- /dev/null
+++ b/testsuite/css/change/simple.css
@@ -0,0 +1,7 @@
+box {
+  color: red;
+}
+
+label {
+  color: green;
+}
diff --git a/testsuite/css/change/simple.nodes b/testsuite/css/change/simple.nodes
new file mode 100644
index 0000000000..4cf52ec676
--- /dev/null
+++ b/testsuite/css/change/simple.nodes
@@ -0,0 +1,5 @@
+[window.background:dir(ltr)]    
+  decoration:dir(ltr)    
+  box.horizontal:dir(ltr)    name
+    label:dir(ltr)    name
+    label.test:dir(ltr)    name
diff --git a/testsuite/css/change/simple.ui b/testsuite/css/change/simple.ui
new file mode 100644
index 0000000000..b5ddb9c1cf
--- /dev/null
+++ b/testsuite/css/change/simple.ui
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Hello World!</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Hello World!</property>
+            <style><class name="test"/></style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/css/change/test2.css b/testsuite/css/change/test2.css
new file mode 100644
index 0000000000..8fa68e444a
--- /dev/null
+++ b/testsuite/css/change/test2.css
@@ -0,0 +1,186 @@
+/* trigger all change flags at least once */
+
+box {
+  color: red;
+}
+
+label {
+  color: green;
+}
+
+label.a:disabled {
+  color: blue;
+}
+
+label.b:selected {
+  color: blue;
+}
+
+label.c:backdrop {
+  color: blue;
+}
+
+label.d:focus {
+  color: blue;
+}
+
+label.e:first-child {
+  color: blue;
+}
+
+label.f:last-child {
+  color: blue;
+}
+
+label.g:nth-child(2) {
+  color: blue;
+}
+
+label.h:nth-last-child(2) {
+  color: blue;
+}
+
+label.i:hover {
+  color: blue;
+}
+
+label ~ label.j {
+  color: blue;
+}
+
+#label ~ label.j1 {
+  color: blue;
+}
+
+label.test ~ label.k {
+  color: blue;
+}
+
+label:hover ~ label.l {
+  color: blue;
+}
+
+label:disabled ~ label.m {
+  color: blue;
+}
+
+label:backdrop ~ label.n {
+  color: blue;
+}
+
+label:selected ~ label.o {
+  color: blue;
+}
+
+label:focus ~ label.p {
+  color: blue;
+}
+
+label:first-child ~ label.q {
+  color: blue;
+}
+
+label:last-child ~ label.r {
+  color: blue;
+}
+
+label:nth-child(2n+5) ~ label.s {
+  color: blue;
+}
+
+label:nth-last-child(2n+5) ~ label.t {
+  color: blue;
+}
+
+label label.u {
+  color: blue;
+}
+
+#label label.u1 {
+  color: blue;
+}
+
+label.test label.v {
+  color: blue;
+}
+
+label:focus label.w {
+  color: blue;
+}
+
+label:hover label.x {
+  color: blue;
+}
+
+label:disabled label.y {
+  color: blue;
+}
+
+label:backdrop label.z {
+  color: blue;
+}
+
+label:selected label.aa {
+  color: blue;
+}
+
+label:first-child label.bb {
+  color: blue;
+}
+
+label:last-child label.cc {
+  color: blue;
+}
+
+label:nth-child(3) label.dd {
+  color: blue;
+}
+
+label:nth-last-child(3) label.ee {
+  color: blue;
+}
+
+label~label label.ff {
+  color: blue;
+}
+
+#label~label label.gg {
+  color: blue;
+}
+
+label.test~label label.hh {
+  color: blue;
+}
+
+label:focus~label label.ii {
+  color: blue;
+}
+
+label:hover~label label.jj {
+  color: blue;
+}
+
+label:backdrop~label label.kk {
+  color: blue;
+}
+
+label:selected~label label.ll {
+  color: blue;
+}
+
+label:first-child~label label.mm {
+  color: blue;
+}
+
+label:last-child~label label.nn {
+  color: blue;
+}
+
+label:nth-child(2)~label label.oo {
+  color: blue;
+}
+
+label:nth-last-child(2)~label label.pp {
+  color: blue;
+}
+
diff --git a/testsuite/css/change/test2.nodes b/testsuite/css/change/test2.nodes
new file mode 100644
index 0000000000..ae80d2a6ca
--- /dev/null
+++ b/testsuite/css/change/test2.nodes
@@ -0,0 +1,48 @@
+[window.background:dir(ltr)]    
+  decoration:dir(ltr)    
+  box.horizontal:dir(ltr)    name
+    label:dir(ltr)    name
+    label.a:dir(ltr)    class|name|disabled
+    label.b:dir(ltr)    class|name|selected
+    label.c:dir(ltr)    class|name|backdrop
+    label.d:dir(ltr)    class|name|state
+    label.e:dir(ltr)    class|name|first-child
+    label.f:dir(ltr)    class|name|last-child
+    label.g:dir(ltr)    class|name|nth-child
+    label.h:dir(ltr)    class|name|nth-last-child
+    label.i:dir(ltr)    class|name|hover
+    label.j:dir(ltr)    class|name|sibling-name
+    label.j1:dir(ltr)    class|name|sibling-id
+    label.k:dir(ltr)    class|name|sibling-class|sibling-name
+    label.l:dir(ltr)    class|name|sibling-name|sibling-hover
+    label.m:dir(ltr)    class|name|sibling-name|sibling-disabled
+    label.n:dir(ltr)    class|name|sibling-name|sibling-backdrop
+    label.o:dir(ltr)    class|name|sibling-name|sibling-selected
+    label.p:dir(ltr)    class|name|sibling-name|sibling-state
+    label.q:dir(ltr)    class|name|sibling-name|sibling-first-child
+    label.r:dir(ltr)    class|name|sibling-name|sibling-last-child
+    label.s:dir(ltr)    class|name|nth-child|sibling-name|sibling-nth-child
+    label.t:dir(ltr)    class|name|nth-last-child|sibling-name|sibling-nth-last-child
+    label.u:dir(ltr)    class|name|parent-name
+    label.u1:dir(ltr)    class|name|parent-id
+    label.v:dir(ltr)    class|name|parent-class|parent-name
+    label.w:dir(ltr)    class|name|parent-name|parent-state
+    label.x:dir(ltr)    class|name|parent-name|parent-hover
+    label.y:dir(ltr)    class|name|parent-name|parent-disabled
+    label.z:dir(ltr)    class|name|parent-name|parent-backdrop
+    label.aa:dir(ltr)    class|name|parent-name|parent-selected
+    label.bb:dir(ltr)    class|name|parent-name|parent-first-child
+    label.cc:dir(ltr)    class|name|parent-name|parent-last-child
+    label.dd:dir(ltr)    class|name|parent-name|parent-nth-child
+    label.ee:dir(ltr)    class|name|parent-name|parent-nth-last-child
+    label.ff:dir(ltr)    class|name|parent-name|parent-sibling-name
+    label.gg:dir(ltr)    class|name|parent-name|parent-sibling-id
+    label.hh:dir(ltr)    class|name|parent-name|parent-sibling-class|parent-sibling-name
+    label.ii:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-state
+    label.jj:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-hover
+    label.kk:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-backdrop
+    label.ll:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-selected
+    label.mm:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-first-child
+    label.nn:dir(ltr)    class|name|parent-name|parent-sibling-name|parent-sibling-last-child
+    label.oo:dir(ltr)    class|name|parent-name|parent-nth-child|parent-sibling-name|parent-sibling-nth-child
+    label.pp:dir(ltr)    
class|name|parent-name|parent-nth-last-child|parent-sibling-name|parent-sibling-nth-last-child
diff --git a/testsuite/css/change/test2.ui b/testsuite/css/change/test2.ui
new file mode 100644
index 0000000000..5407cef3e1
--- /dev/null
+++ b/testsuite/css/change/test2.ui
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkBox">
+        <child>
+          <object class="GtkLabel">
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="a"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="b"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="c"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="d"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="e"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="f"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="g"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="h"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="i"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="j"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="j1"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="k"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="l"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="m"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="n"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="o"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="p"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="q"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="r"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="s"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="t"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="u"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="u1"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="v"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="w"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="x"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="y"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="z"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="aa"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="bb"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="cc"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="dd"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="ee"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="ff"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="gg"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="hh"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="ii"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="jj"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="kk"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="ll"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="mm"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="nn"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="oo"/></style>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <style><class name="pp"/></style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/css/change/test3.css b/testsuite/css/change/test3.css
new file mode 100644
index 0000000000..c081d895fa
--- /dev/null
+++ b/testsuite/css/change/test3.css
@@ -0,0 +1,21 @@
+/* test combining multiple state changes */
+
+box {
+  color: red;
+}
+
+label:hover {
+  color: green;
+}
+
+label:backdrop {
+  color: blue;
+}
+
+label:disabled {
+  color: blue;
+}
+
+label:focus {
+  color: blue;
+}
diff --git a/testsuite/css/change/test3.nodes b/testsuite/css/change/test3.nodes
new file mode 100644
index 0000000000..c2afcaf509
--- /dev/null
+++ b/testsuite/css/change/test3.nodes
@@ -0,0 +1,5 @@
+[window.background:dir(ltr)]    
+  decoration:dir(ltr)    
+  box.horizontal:dir(ltr)    name
+    label:dir(ltr)    name|state|hover|disabled|backdrop
+    label.test:dir(ltr)    name|state|hover|disabled|backdrop
diff --git a/testsuite/css/change/test3.ui b/testsuite/css/change/test3.ui
new file mode 100644
index 0000000000..b5ddb9c1cf
--- /dev/null
+++ b/testsuite/css/change/test3.ui
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Hello World!</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Hello World!</property>
+            <style><class name="test"/></style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/css/meson.build b/testsuite/css/meson.build
index eefea5aff8..98509c29ca 100644
--- a/testsuite/css/meson.build
+++ b/testsuite/css/meson.build
@@ -1,6 +1,7 @@
 subdir('parser')
 subdir('nodes')
 subdir('style')
+subdir('change')
 
 testexecdir = join_paths(installed_test_bindir, 'css')
 testdatadir = join_paths(installed_test_datadir, 'css')


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