[gtk+/wip/baedert/drawing: 19/66] scale: Fix css node ordering and expected results



commit 8edc8121eddee40ab81124c81bfb5925fdf9c6a6
Author: Timm Bäder <mail baedert org>
Date:   Mon May 22 14:15:39 2017 +0200

    scale: Fix css node ordering and expected results
    
    Add :dir(ltr) where expected, i.e. everywhere we now have a widget but
    had a gadget before.
    Also, fix the expected output to expect mark subnodes in the order
    specified in the GtkScale does, i.e.
    
    ├── mark
        ├── [label]
        ╰── indicator
    
    for marks at the top of the scale and
    
    ├── mark
        ├── indicator
        ╰── [label]
    
    For marks at the bottom of the scale.

 gtk/gtkscale.c                  |    5 ++-
 testsuite/css/nodes/scale.nodes |   79 ++++++++++++++++++---------------------
 2 files changed, 40 insertions(+), 44 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 8227201..002e9d4 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1953,7 +1953,10 @@ gtk_scale_add_mark (GtkScale        *scale,
                                          "use-markup", TRUE,
                                          "label", mark->markup,
                                          NULL);
-      gtk_widget_set_parent (mark->label_widget, mark->widget);
+      if (marks_widget == priv->top_marks_widget)
+        gtk_widget_insert_after (mark->label_widget, mark->widget, NULL);
+      else
+        gtk_widget_insert_before (mark->label_widget, mark->widget, NULL);
     }
 
   m = g_slist_find (priv->marks, mark);
diff --git a/testsuite/css/nodes/scale.nodes b/testsuite/css/nodes/scale.nodes
index 90cf41a..f289355 100644
--- a/testsuite/css/nodes/scale.nodes
+++ b/testsuite/css/nodes/scale.nodes
@@ -2,62 +2,55 @@
   decoration:dir(ltr)
   box#scales.vertical:dir(ltr)
     scale.horizontal:dir(ltr)
-      value.top
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
+      value.top:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
     scale.horizontal:dir(ltr)
-      value.bottom
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
+      value.bottom:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
     scale.horizontal:dir(ltr)
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
-          fill.top:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
+        fill.top:dir(ltr)
     scale.horizontal:dir(ltr)
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.bottom:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.bottom:dir(ltr)
     scale.horizontal.marks-before:dir(ltr)
       marks.top:dir(ltr)
         mark:dir(ltr)
-          indicator
-          label
+          label:dir(ltr)
+          indicator:dir(ltr)
         mark:dir(ltr)
-          indicator
-          label
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
+          label:dir(ltr)
+          indicator:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
     scale.horizontal.marks-before.marks-after:dir(ltr)
       marks.top:dir(ltr)
         mark:dir(ltr)
-          indicator
-          label
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
+          label:dir(ltr)
+          indicator:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
       marks.bottom:dir(ltr)
         mark:dir(ltr)
-          label
-          indicator
+          indicator:dir(ltr)
+          label:dir(ltr)
     scale.horizontal.marks-after:dir(ltr)
-      contents
-        trough:dir(ltr)
-          slider:dir(ltr)
-          highlight.top:dir(ltr)
+      trough:dir(ltr)
+        slider:dir(ltr)
+        highlight.top:dir(ltr)
       marks.bottom:dir(ltr)
         mark:dir(ltr)
-          label
-          indicator
+          indicator:dir(ltr)
+          label:dir(ltr)
         mark:dir(ltr)
-          label
-          indicator
+          indicator:dir(ltr)
+          label:dir(ltr)


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