[pango] Some test updates



commit cbf69898fc840ebf284310ed9e2c03b165155253
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 14 19:15:00 2019 -0400

    Some test updates
    
    Share the attribute printing code between
    all the tests, update expected output to match.

 tests/itemize/one.expected      |   2 +-
 tests/itemize/two.expected      |  12 ++--
 tests/layouts/valid-1.expected  |  22 ++++----
 tests/layouts/valid-2.expected  |  14 ++---
 tests/layouts/valid-3.expected  |   8 +--
 tests/markups/valid-1.expected  |   6 +-
 tests/markups/valid-10.expected |  22 ++++----
 tests/markups/valid-11.expected |  66 +++++++++++-----------
 tests/markups/valid-2.expected  |   6 +-
 tests/markups/valid-3.expected  |  22 ++++----
 tests/markups/valid-4.expected  |  38 ++++++-------
 tests/markups/valid-5.expected  |   8 +--
 tests/markups/valid-6.expected  |  14 ++---
 tests/markups/valid-7.expected  |   4 +-
 tests/markups/valid-8.expected  |  16 +++---
 tests/markups/valid-9.expected  |   2 +-
 tests/test-common.c             | 103 +++++++++++++++------------------
 tests/test-common.h             |   1 +
 tests/test-itemize.c            | 102 +--------------------------------
 tests/test-layout.c             |   8 +--
 tests/testattributes.c          | 122 ++++++++++++++++++++--------------------
 21 files changed, 245 insertions(+), 353 deletions(-)
---
diff --git a/tests/itemize/one.expected b/tests/itemize/one.expected
index 88772bb4..deaa544d 100644
--- a/tests/itemize/one.expected
+++ b/tests/itemize/one.expected
@@ -2,7 +2,7 @@
 
 Items:  a b            |[0x2028]       |c              
 Font:   Cantarell 11   |Cantarell 11   |Cantarell 11   
-Script: Latn           |Latn           |Latn           
+Script: latin          |latin          |latin          
 Lang:   en-us          |en-us          |en-us          
 Bidi:   0              |0              |0              
 Attrs:  [0,7]fallback=0|[0,7]fallback=0|[0,7]fallback=0
diff --git a/tests/itemize/two.expected b/tests/itemize/two.expected
index f0adbad0..57446958 100644
--- a/tests/itemize/two.expected
+++ b/tests/itemize/two.expected
@@ -1,8 +1,8 @@
 <span font="Cantarell 11">one <span font_features="tnum=0">tw<u>o</u> <span 
font_features="dlig=1">two</span> </span>th<b>r</b>ee</span>
 
-Items:  one         |tw                   |o                                     |                     |two  
                                      |                     |th          |r                |ee          
-Font:   Cantarell 11|Cantarell 11         |Cantarell 11                          |Cantarell 11         
|Cantarell 11                               |Cantarell 11         |Cantarell 11|Cantarell Bold 11|Cantarell 11
-Script: Latn        |Latn                 |Latn                                  |Latn                 |Latn 
                                      |Latn                 |Latn        |Latn             |Latn        
-Lang:   en-us       |en-us                |en-us                                 |en-us                
|en-us                                      |en-us                |en-us       |en-us            |en-us       
-Bidi:   0           |0                    |0                                     |0                    |0    
                                      |0                    |0           |0                |0           
-Attrs:              
|[4,12]features=tnum=0|[4,12]features=tnum=0,[6,7]underline=1|[4,12]features=tnum=0|[4,12]features=tnum=0,[8,11]features=dlig=1|[4,12]features=tnum=0|
            |                 |            
+Items:  one         |tw                        |o                                          |                 
         |two                                                  |                          |th          |r     
           |ee          
+Font:   Cantarell 11|Cantarell 11              |Cantarell 11                               |Cantarell 11     
         |Cantarell 11                                         |Cantarell 11              |Cantarell 
11|Cantarell Bold 11|Cantarell 11
+Script: latin       |latin                     |latin                                      |latin            
         |latin                                                |latin                     |latin       |latin 
           |latin       
+Lang:   en-us       |en-us                     |en-us                                      |en-us            
         |en-us                                                |en-us                     |en-us       |en-us 
           |en-us       
+Bidi:   0           |0                         |0                                          |0                
         |0                                                    |0                         |0           |0     
           |0           
+Attrs:              
|[4,12]font-features=tnum=0|[4,12]font-features=tnum=0,[6,7]underline=1|[4,12]font-features=tnum=0|[4,12]font-features=tnum=0,[8,11]font-features=dlig=1|[4,12]font-features=tnum=0|
            |                 |            
diff --git a/tests/layouts/valid-1.expected b/tests/layouts/valid-1.expected
index e03bf31d..292d6f43 100644
--- a/tests/layouts/valid-1.expected
+++ b/tests/layouts/valid-1.expected
@@ -1,35 +1,35 @@
 This is a test of the automatic emergency brake!
 
----
+--- parameters
 
 wrapped: 0
 ellipsized: 1
 lines: 2
 width: 225280
 
----
+--- attributes
 
 range 0 22
 range 22 41
-[22 41] foreground #00000000ffff
-[22 41] underline 1
+[22,41]foreground=#00000000ffff
+[22,41]underline=1
 range 41 2147483647
 
----
+--- lines
 
 i=1, index=0, paragraph-start=1, dir=ltr 'This is a test of the automatic emergency brake!
 '
 i=2, index=49, paragraph-start=1, dir=ltr ''
 
----
+--- runs
 
 i=1, index=0, chars=22, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'This 
is a test of the '
 i=2, index=22, chars=11, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 
'automatic e'
-  [22 41] foreground #00000000ffff
-  [22 41] underline 1
+[22,41]foreground=#00000000ffff
+[22,41]underline=1
 i=3, index=33, chars=15, level=0, gravity=south, flags=2, font=OMITTED, script=common, language=en-us, 
'mergency brake!'
-  [0 2147483647] fallback 0
-  [22 41] foreground #00000000ffff
-  [22 41] underline 1
+[0,2147483647]fallback=0
+[22,41]foreground=#00000000ffff
+[22,41]underline=1
 i=4, index=48, no run, line end
 i=5, index=49, no run, line end
diff --git a/tests/layouts/valid-2.expected b/tests/layouts/valid-2.expected
index 1467dd25..2efc56fe 100644
--- a/tests/layouts/valid-2.expected
+++ b/tests/layouts/valid-2.expected
@@ -1,34 +1,34 @@
 test the blue drink after dinner
 
----
+--- parameters
 
 wrapped: 0
 ellipsized: 0
 lines: 2
 
----
+--- attributes
 
 range 0 9
 range 9 13
-[9 13] style 2
+[9,13]style=2
 range 13 20
 range 20 25
-[20 25] underline 1
+[20,25]underline=1
 range 25 2147483647
 
----
+--- lines
 
 i=1, index=0, paragraph-start=1, dir=ltr 'test the blue drink after dinner
 '
 i=2, index=33, paragraph-start=1, dir=ltr ''
 
----
+--- runs
 
 i=1, index=0, chars=9, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'test 
the '
 i=2, index=9, chars=4, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'blue'
 i=3, index=13, chars=7, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' drink 
'
 i=4, index=20, chars=5, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'after'
-  [20 25] underline 1
+[20,25]underline=1
 i=5, index=25, chars=7, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, ' 
dinner'
 i=6, index=32, no run, line end
 i=7, index=33, no run, line end
diff --git a/tests/layouts/valid-3.expected b/tests/layouts/valid-3.expected
index ce983c34..247c61bf 100644
--- a/tests/layouts/valid-3.expected
+++ b/tests/layouts/valid-3.expected
@@ -1,22 +1,22 @@
 ABC😀️D
 
----
+--- parameters
 
 wrapped: 0
 ellipsized: 0
 lines: 2
 
----
+--- attributes
 
 range 0 2147483647
 
----
+--- lines
 
 i=1, index=0, paragraph-start=1, dir=ltr 'ABC😀️D
 '
 i=2, index=12, paragraph-start=1, dir=ltr ''
 
----
+--- runs
 
 i=1, index=0, chars=3, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, 'ABC'
 i=2, index=3, chars=2, level=0, gravity=south, flags=0, font=OMITTED, script=latin, language=en-us, '😀️'
diff --git a/tests/markups/valid-1.expected b/tests/markups/valid-1.expected
index 09546763..6ad9a22a 100644
--- a/tests/markups/valid-1.expected
+++ b/tests/markups/valid-1.expected
@@ -4,11 +4,11 @@ Blue text is cool!
 ---
 
 range 0 9
-[0 9] scale 1.440000
-[0 9] foreground #00000000ffff
+[0,9]scale=1.440000
+[0,9]foreground=#00000000ffff
 range 9 13
 range 13 17
-[13 17] style 2
+[13,17]style=2
 range 17 2147483647
 
 
diff --git a/tests/markups/valid-10.expected b/tests/markups/valid-10.expected
index 1479696c..28f53835 100644
--- a/tests/markups/valid-10.expected
+++ b/tests/markups/valid-10.expected
@@ -4,17 +4,17 @@ Lots of attrs
 ---
 
 range 0 13
-[0 13] font Sans Italic 12 @wdth=100,wght=200
-[0 13] foreground #0000ffff0000
-[0 13] background #f0f0f0f0f0f0
-[0 13] underline 2
-[0 13] underline-color #ffff00000000
-[0 13] gravity 0
-[0 13] gravity-hint 1
-[0 13] strikethrough 1
-[0 13] strikethrough-color #00000000ffff
-[0 13] fallback 0
-[0 13] language de
+[0,13]font-desc=Sans Italic 12 @wdth=100,wght=200
+[0,13]foreground=#0000ffff0000
+[0,13]background=#f0f0f0f0f0f0
+[0,13]underline=2
+[0,13]underline-color=#ffff00000000
+[0,13]gravity=0
+[0,13]gravity-hint=1
+[0,13]strikethrough=1
+[0,13]strikethrough-color=#00000000ffff
+[0,13]fallback=0
+[0,13]language=de
 range 13 2147483647
 
 
diff --git a/tests/markups/valid-11.expected b/tests/markups/valid-11.expected
index a41b65b8..bd3f83f2 100644
--- a/tests/markups/valid-11.expected
+++ b/tests/markups/valid-11.expected
@@ -4,41 +4,41 @@ Lots of attrs
 ---
 
 range 0 5
-[0 13] font Sans Italic 12 @wdth=100,wght=200
-[0 13] foreground #0000ffff0000
-[0 13] background #f0f0f0f0f0f0
-[0 13] underline 2
-[0 13] underline-color #ffff00000000
-[0 13] gravity 0
-[0 13] gravity-hint 1
-[0 13] strikethrough 1
-[0 13] strikethrough-color #00000000ffff
-[0 13] fallback 0
-[0 13] language de
+[0,13]font-desc=Sans Italic 12 @wdth=100,wght=200
+[0,13]foreground=#0000ffff0000
+[0,13]background=#f0f0f0f0f0f0
+[0,13]underline=2
+[0,13]underline-color=#ffff00000000
+[0,13]gravity=0
+[0,13]gravity-hint=1
+[0,13]strikethrough=1
+[0,13]strikethrough-color=#00000000ffff
+[0,13]fallback=0
+[0,13]language=de
 range 5 7
-[0 13] foreground #0000ffff0000
-[0 13] background #f0f0f0f0f0f0
-[0 13] underline 2
-[0 13] underline-color #ffff00000000
-[0 13] gravity 0
-[0 13] gravity-hint 1
-[0 13] strikethrough 1
-[0 13] strikethrough-color #00000000ffff
-[0 13] fallback 0
-[0 13] language de
-[5 7] font Bold
+[0,13]foreground=#0000ffff0000
+[0,13]background=#f0f0f0f0f0f0
+[0,13]underline=2
+[0,13]underline-color=#ffff00000000
+[0,13]gravity=0
+[0,13]gravity-hint=1
+[0,13]strikethrough=1
+[0,13]strikethrough-color=#00000000ffff
+[0,13]fallback=0
+[0,13]language=de
+[5,7]font-desc=Bold
 range 7 13
-[0 13] font Sans Italic 12 @wdth=100,wght=200
-[0 13] foreground #0000ffff0000
-[0 13] background #f0f0f0f0f0f0
-[0 13] underline 2
-[0 13] underline-color #ffff00000000
-[0 13] gravity 0
-[0 13] gravity-hint 1
-[0 13] strikethrough 1
-[0 13] strikethrough-color #00000000ffff
-[0 13] fallback 0
-[0 13] language de
+[0,13]font-desc=Sans Italic 12 @wdth=100,wght=200
+[0,13]foreground=#0000ffff0000
+[0,13]background=#f0f0f0f0f0f0
+[0,13]underline=2
+[0,13]underline-color=#ffff00000000
+[0,13]gravity=0
+[0,13]gravity-hint=1
+[0,13]strikethrough=1
+[0,13]strikethrough-color=#00000000ffff
+[0,13]fallback=0
+[0,13]language=de
 range 13 2147483647
 
 
diff --git a/tests/markups/valid-2.expected b/tests/markups/valid-2.expected
index 09546763..6ad9a22a 100644
--- a/tests/markups/valid-2.expected
+++ b/tests/markups/valid-2.expected
@@ -4,11 +4,11 @@ Blue text is cool!
 ---
 
 range 0 9
-[0 9] scale 1.440000
-[0 9] foreground #00000000ffff
+[0,9]scale=1.440000
+[0,9]foreground=#00000000ffff
 range 9 13
 range 13 17
-[13 17] style 2
+[13,17]style=2
 range 17 2147483647
 
 
diff --git a/tests/markups/valid-3.expected b/tests/markups/valid-3.expected
index 1943fc37..6f372b15 100644
--- a/tests/markups/valid-3.expected
+++ b/tests/markups/valid-3.expected
@@ -4,17 +4,17 @@ Lots of attrs
 ---
 
 range 0 13
-[0 13] font Sans Italic 12
-[0 13] foreground #0000ffff0000
-[0 13] background #f0f0f0f0f0f0
-[0 13] underline 2
-[0 13] underline-color #ffff00000000
-[0 13] gravity 0
-[0 13] gravity-hint 1
-[0 13] strikethrough 1
-[0 13] strikethrough-color #00000000ffff
-[0 13] fallback 0
-[0 13] language de
+[0,13]font-desc=Sans Italic 12
+[0,13]foreground=#0000ffff0000
+[0,13]background=#f0f0f0f0f0f0
+[0,13]underline=2
+[0,13]underline-color=#ffff00000000
+[0,13]gravity=0
+[0,13]gravity-hint=1
+[0,13]strikethrough=1
+[0,13]strikethrough-color=#00000000ffff
+[0,13]fallback=0
+[0,13]language=de
 range 13 2147483647
 
 
diff --git a/tests/markups/valid-4.expected b/tests/markups/valid-4.expected
index 171e84e1..0391ec8e 100644
--- a/tests/markups/valid-4.expected
+++ b/tests/markups/valid-4.expected
@@ -4,37 +4,37 @@ bold big italic strikethroughsub smallsup tt underline
 ---
 
 range 0 5
-[0 15] weight 700
+[0,15]weight=700
 range 5 8
-[0 15] weight 700
-[5 8] scale 1.200000
+[0,15]weight=700
+[5,8]scale=1.200000
 range 8 9
-[0 15] weight 700
+[0,15]weight=700
 range 9 15
-[0 15] weight 700
-[9 15] style 2
+[0,15]weight=700
+[9,15]style=2
 range 15 16
 range 16 29
-[16 41] strikethrough 1
+[16,41]strikethrough=1
 range 29 32
-[16 41] strikethrough 1
-[29 32] scale 0.833333
-[29 32] rise -5000
+[16,41]strikethrough=1
+[29,32]scale=0.833333
+[29,32]rise=-5000
 range 32 33
-[16 41] strikethrough 1
+[16,41]strikethrough=1
 range 33 38
-[16 41] strikethrough 1
-[33 38] scale 0.833333
+[16,41]strikethrough=1
+[33,38]scale=0.833333
 range 38 41
-[16 41] strikethrough 1
-[38 41] scale 0.833333
-[38 41] rise 5000
+[16,41]strikethrough=1
+[38,41]scale=0.833333
+[38,41]rise=5000
 range 41 42
 range 42 45
-[42 54] family Monospace
+[42,54]family=Monospace
 range 45 54
-[42 54] family Monospace
-[45 54] underline 1
+[42,54]family=Monospace
+[45,54]underline=1
 range 54 2147483647
 
 
diff --git a/tests/markups/valid-5.expected b/tests/markups/valid-5.expected
index ee3ae71e..a26c4f71 100644
--- a/tests/markups/valid-5.expected
+++ b/tests/markups/valid-5.expected
@@ -7,16 +7,16 @@ Text
 ---
 
 range 0 4
-[0 4] foreground #222233334444
+[0,4]foreground=#222233334444
 range 4 5
 range 5 9
-[5 9] foreground #222233334444
+[5,9]foreground=#222233334444
 range 9 10
 range 10 14
-[10 14] foreground #222233334444
+[10,14]foreground=#222233334444
 range 14 15
 range 15 19
-[15 19] foreground #222233334444
+[15,19]foreground=#222233334444
 range 19 2147483647
 
 
diff --git a/tests/markups/valid-6.expected b/tests/markups/valid-6.expected
index d5d6ea45..40807607 100644
--- a/tests/markups/valid-6.expected
+++ b/tests/markups/valid-6.expected
@@ -7,19 +7,19 @@ Text
 ---
 
 range 0 4
-[0 4] foreground #222233334444
-[0 4] foreground-alpha 5555
+[0,4]foreground=#222233334444
+[0,4]foreground-alpha=21845
 range 4 5
 range 5 9
-[5 9] foreground #222233334444
-[5 9] foreground-alpha 5555
+[5,9]foreground=#222233334444
+[5,9]foreground-alpha=21845
 range 9 10
 range 10 14
-[10 14] foreground #222233334444
+[10,14]foreground=#222233334444
 range 14 15
 range 15 19
-[15 19] foreground #222233334444
-[15 19] foreground-alpha 5555
+[15,19]foreground=#222233334444
+[15,19]foreground-alpha=21845
 range 19 2147483647
 
 
diff --git a/tests/markups/valid-7.expected b/tests/markups/valid-7.expected
index d30d165d..0658ab27 100644
--- a/tests/markups/valid-7.expected
+++ b/tests/markups/valid-7.expected
@@ -5,10 +5,10 @@ Text
 ---
 
 range 0 4
-[0 4] underline-color #222233334444
+[0,4]underline-color=#222233334444
 range 4 5
 range 5 9
-[5 9] strikethrough-color #222233334444
+[5,9]strikethrough-color=#222233334444
 range 9 2147483647
 
 
diff --git a/tests/markups/valid-8.expected b/tests/markups/valid-8.expected
index de8eb6b8..4f16487f 100644
--- a/tests/markups/valid-8.expected
+++ b/tests/markups/valid-8.expected
@@ -7,20 +7,20 @@ Text
 ---
 
 range 0 4
-[0 4] foreground #00000000ffff
-[0 4] foreground-alpha ffff
+[0,4]foreground=#00000000ffff
+[0,4]foreground-alpha=65535
 range 4 5
 range 5 9
-[5 9] foreground #00000000ffff
-[5 9] foreground-alpha 7fff
+[5,9]foreground=#00000000ffff
+[5,9]foreground-alpha=32767
 range 9 10
 range 10 14
-[10 14] background #00000000ffff
-[10 14] background-alpha 0001
+[10,14]background=#00000000ffff
+[10,14]background-alpha=1
 range 14 15
 range 15 19
-[15 19] background #00000000ffff
-[15 19] background-alpha 547a
+[15,19]background=#00000000ffff
+[15,19]background-alpha=21626
 range 19 2147483647
 
 
diff --git a/tests/markups/valid-9.expected b/tests/markups/valid-9.expected
index 7931e705..71c370b2 100644
--- a/tests/markups/valid-9.expected
+++ b/tests/markups/valid-9.expected
@@ -4,7 +4,7 @@ Blue text
 ---
 
 range 0 9
-[0 9] font-features kern 0, dlig, lnum 1, -pnum
+[0,9]font-features=kern 0, dlig, lnum 1, -pnum
 range 9 2147483647
 
 
diff --git a/tests/test-common.c b/tests/test-common.c
index 34c0e9a8..83f4d99c 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -84,83 +84,56 @@ done:
 void
 print_attribute (PangoAttribute *attr, GString *string)
 {
-  g_string_append_printf (string, "[%d %d] ", attr->start_index, attr->end_index);
+  GEnumClass *class;
+  GEnumValue *value;
+
+  g_string_append_printf (string, "[%d,%d]", attr->start_index, attr->end_index);
+
+  class = g_type_class_ref (pango_attr_type_get_type ());
+  value = g_enum_get_value (class, attr->klass->type);
+  g_string_append_printf (string, "%s=", value->value_nick);
+  g_type_class_unref (class);
+
   switch (attr->klass->type)
     {
     case PANGO_ATTR_LANGUAGE:
-      g_string_append_printf (string,"language %s\n", pango_language_to_string (((PangoAttrLanguage 
*)attr)->value));
+      g_string_append_printf (string, "%s", pango_language_to_string (((PangoAttrLanguage *)attr)->value));
       break;
     case PANGO_ATTR_FAMILY:
-      g_string_append_printf (string,"family %s\n", ((PangoAttrString *)attr)->value);
+    case PANGO_ATTR_FONT_FEATURES:
+      g_string_append_printf (string, "%s", ((PangoAttrString *)attr)->value);
       break;
     case PANGO_ATTR_STYLE:
-      g_string_append_printf (string,"style %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_WEIGHT:
-      g_string_append_printf (string,"weight %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_VARIANT:
-      g_string_append_printf (string,"variant %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_STRETCH:
-      g_string_append_printf (string,"stretch %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_SIZE:
-      g_string_append_printf (string,"size %d\n", ((PangoAttrSize *)attr)->size);
-      break;
-    case PANGO_ATTR_FONT_DESC:
-      g_string_append_printf (string,"font %s\n", pango_font_description_to_string (((PangoAttrFontDesc 
*)attr)->desc));
-      break;
-    case PANGO_ATTR_FOREGROUND:
-      g_string_append_printf (string,"foreground %s\n", pango_color_to_string (&((PangoAttrColor 
*)attr)->color));
-      break;
-    case PANGO_ATTR_BACKGROUND:
-      g_string_append_printf (string,"background %s\n", pango_color_to_string (&((PangoAttrColor 
*)attr)->color));
-      break;
+    case PANGO_ATTR_ABSOLUTE_SIZE:
     case PANGO_ATTR_UNDERLINE:
-      g_string_append_printf (string,"underline %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_STRIKETHROUGH:
-      g_string_append_printf (string,"strikethrough %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_RISE:
-      g_string_append_printf (string,"rise %d\n", ((PangoAttrInt *)attr)->value);
-      break;
-    case PANGO_ATTR_SHAPE:
-      g_string_append_printf (string,"shape\n");
-      break;
-    case PANGO_ATTR_SCALE:
-      g_string_append_printf (string,"scale %f\n", ((PangoAttrFloat *)attr)->value);
-      break;
     case PANGO_ATTR_FALLBACK:
-      g_string_append_printf (string,"fallback %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_LETTER_SPACING:
-      g_string_append_printf (string,"letter-spacing %d\n", ((PangoAttrInt *)attr)->value);
-      break;
-    case PANGO_ATTR_UNDERLINE_COLOR:
-      g_string_append_printf (string,"underline-color %s\n", pango_color_to_string (&((PangoAttrColor 
*)attr)->color));
-      break;
-    case PANGO_ATTR_STRIKETHROUGH_COLOR:
-      g_string_append_printf (string,"strikethrough-color %s\n", pango_color_to_string (&((PangoAttrColor 
*)attr)->color));
-      break;
-    case PANGO_ATTR_ABSOLUTE_SIZE:
-      g_string_append_printf (string,"absolute-size %d\n", ((PangoAttrSize *)attr)->size);
-      break;
     case PANGO_ATTR_GRAVITY:
-      g_string_append_printf (string,"gravity %d\n", ((PangoAttrInt *)attr)->value);
-      break;
     case PANGO_ATTR_GRAVITY_HINT:
-      g_string_append_printf (string,"gravity-hint %d\n", ((PangoAttrInt *)attr)->value);
+    case PANGO_ATTR_FOREGROUND_ALPHA:
+    case PANGO_ATTR_BACKGROUND_ALPHA:
+      g_string_append_printf (string, "%d", ((PangoAttrInt *)attr)->value);
       break;
-    case PANGO_ATTR_FONT_FEATURES:
-      g_string_append_printf (string,"font-features %s\n", ((PangoAttrString *)attr)->value);
+    case PANGO_ATTR_FONT_DESC:
+      g_string_append_printf (string, "%s", pango_font_description_to_string (((PangoAttrFontDesc 
*)attr)->desc));
       break;
-    case PANGO_ATTR_FOREGROUND_ALPHA:
-      g_string_append_printf (string,"foreground-alpha %04x\n", ((PangoAttrInt *)attr)->value);
+    case PANGO_ATTR_FOREGROUND:
+    case PANGO_ATTR_BACKGROUND:
+    case PANGO_ATTR_UNDERLINE_COLOR:
+    case PANGO_ATTR_STRIKETHROUGH_COLOR:
+      g_string_append_printf (string, "%s", pango_color_to_string (&((PangoAttrColor *)attr)->color));
       break;
-    case PANGO_ATTR_BACKGROUND_ALPHA:
-      g_string_append_printf (string,"background-alpha %04x\n", ((PangoAttrInt *)attr)->value);
+    case PANGO_ATTR_SHAPE:
+      g_string_append_printf (string, "shape");
+      break;
+    case PANGO_ATTR_SCALE:
+      g_string_append_printf (string,"%f", ((PangoAttrFloat *)attr)->value);
       break;
     default:
       g_assert_not_reached ();
@@ -185,6 +158,7 @@ print_attr_list (PangoAttrList *attrs, GString *string)
       {
         PangoAttribute *attr = l->data;
         print_attribute (attr, string);
+        g_string_append (string, "\n");
       }
     g_slist_free_full (list, (GDestroyNotify)pango_attribute_destroy);
   } while (pango_attr_iterator_next (iter));
@@ -201,8 +175,8 @@ print_attributes (GSList *attrs, GString *string)
     {
       PangoAttribute *attr = l->data;
 
-      g_string_append (string, "  ");
       print_attribute (attr, string);
+      g_string_append (string, "\n");
     }
 }
 
@@ -218,3 +192,18 @@ attr_list_to_list (PangoAttrList *attrs)
 {
   return ((AL*)attrs)->attributes;
 }
+
+const char *
+get_script_name (GUnicodeScript s)
+{
+  GEnumClass *class;
+  GEnumValue *value;
+  const char *nick;
+
+  class = g_type_class_ref (g_unicode_script_get_type ());
+  value = g_enum_get_value (class, s);
+  nick = value->value_nick;
+  g_type_class_unref (class);
+  return nick;
+}
+
diff --git a/tests/test-common.h b/tests/test-common.h
index ae81d3aa..bf48e06e 100644
--- a/tests/test-common.h
+++ b/tests/test-common.h
@@ -17,6 +17,7 @@ void print_attr_list (PangoAttrList  *attrs,
 
 GSList *attr_list_to_list (PangoAttrList *attrs);
 
+const char *get_script_name (GUnicodeScript s);
 
 
 #endif
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 3c88e3da..2e99f7c3 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -34,36 +34,6 @@
 
 static PangoContext *context;
 
-static const char *
-script_name (GUnicodeScript s)
-{
-  const char *names[] = {
-    "Zyyy", "Zinh", "Arab", "Armn", "Beng", "Bopo", "Cher",
-    "Copt", "Cyrl", "Dsrt", "Deva", "Ethi", "Geor", "Goth",
-    "Grek", "Gujr", "Guru", "Hani", "Hang", "Hebr", "Hira",
-    "Knda", "Kana", "Khmr", "Laoo", "Latn", "Mlym", "Mong",
-    "Mymr", "Ogam", "Ital", "Orya", "Runr", "Sinh", "Syrc",
-    "Taml", "Telu", "Thaa", "Thai", "Tibt", "Cans", "Yiii",
-    "Tglg", "Hano", "Buhd", "Tagb", "Brai", "Cprt", "Limb",
-    "Osma", "Shaw", "Linb", "Tale", "Ugar", "Talu", "Bugi",
-    "Glag", "Tfng", "Sylo", "Xpeo", "Khar", "Zzzz", "Bali",
-    "Xsux", "Phnx", "Phag", "Nkoo", "Kali", "Lepc", "Rjng",
-    "Sund", "Saur", "Cham", "Olck", "Vaii", "Cari", "Lyci",
-    "Lydi", "Avst", "Bamu", "Egyp", "Armi", "Phli", "Prti",
-    "Java", "Kthi", "Lisu", "Mtei", "Sarb", "Orkh", "Samr",
-    "Lana", "Tavt", "Batk", "Brah", "Mand", "Cakm", "Merc",
-    "Mero", "Plrd", "Shrd", "Sora", "Takr", "Bass", "Aghb",
-    "Dupl", "Elba", "Gran", "Khoj", "Sind", "Lina", "Mahj",
-    "Mani", "Mend", "Modi", "Mroo", "Nbat", "Narb", "Perm",
-    "Hmng", "Palm", "Pauc", "Phlp", "Sidd", "Tirh", "Wara",
-    "Ahom", "Hluw", "Hatr", "Mult", "Hung", "Sgnw", "Adlm",
-    "Bhks", "Marc", "Newa", "Osge", "Tang", "Gonm", "Nshu",
-    "Soyo", "Zanb", "Dogr", "Gong", "Rohg", "Maka", "Medf",
-    "Sogo", "Sogd", "Elym", "Nand", "Rohg", "Wcho"
-  };
-  return names[s];
-}
-
 static void
 append_text (GString    *s,
              const char *text,
@@ -81,74 +51,6 @@ append_text (GString    *s,
     }
 }
 
-static void
-append_attribute (PangoAttribute *attr, GString *string)
-{
-  GEnumClass *class;
-  GEnumValue *value;
-
-  g_string_append_printf (string, "[%u,%u]", attr->start_index, attr->end_index);
-
-  class = g_type_class_ref (pango_attr_type_get_type ());
-  value = g_enum_get_value (class, attr->klass->type);
-  g_string_append_printf (string, "%s=", value->value_nick);
-  g_type_class_unref (class);
-
-  switch (attr->klass->type)
-    {
-    case PANGO_ATTR_LANGUAGE:
-      g_string_append_printf (string, "%s", pango_language_to_string (((PangoAttrLanguage *)attr)->value));
-      break;
-    case PANGO_ATTR_FAMILY:
-    case PANGO_ATTR_FONT_FEATURES:
-      g_string_append_printf (string, "%s", ((PangoAttrString*)attr)->value);
-      break;
-    case PANGO_ATTR_STYLE:
-    case PANGO_ATTR_WEIGHT:
-    case PANGO_ATTR_VARIANT:
-    case PANGO_ATTR_STRETCH:
-    case PANGO_ATTR_UNDERLINE:
-    case PANGO_ATTR_STRIKETHROUGH:
-    case PANGO_ATTR_RISE:
-    case PANGO_ATTR_FALLBACK:
-    case PANGO_ATTR_LETTER_SPACING:
-    case PANGO_ATTR_GRAVITY:
-    case PANGO_ATTR_GRAVITY_HINT:
-    case PANGO_ATTR_FOREGROUND_ALPHA:
-    case PANGO_ATTR_BACKGROUND_ALPHA:
-      g_string_append_printf (string, "%d", ((PangoAttrInt*)attr)->value);
-      break;
-    case PANGO_ATTR_SIZE:
-    case PANGO_ATTR_ABSOLUTE_SIZE:
-      g_string_append_printf (string, "%d", ((PangoAttrSize*)attr)->size);
-      break;
-    case PANGO_ATTR_FONT_DESC:
-      {
-        char *desc = pango_font_description_to_string (((PangoAttrFontDesc*)attr)->desc);
-        g_string_append_printf (string, "%s", desc);
-        g_free (desc);
-      }
-      break;
-
-    case PANGO_ATTR_FOREGROUND:
-    case PANGO_ATTR_BACKGROUND:
-    case PANGO_ATTR_UNDERLINE_COLOR:
-    case PANGO_ATTR_STRIKETHROUGH_COLOR:
-      g_string_append_printf (string, "%d:%d:%d",
-                              ((PangoAttrColor*)attr)->color.red,
-                              ((PangoAttrColor*)attr)->color.green,
-                              ((PangoAttrColor*)attr)->color.blue);
-      break;
-    case PANGO_ATTR_SHAPE:
-      break;
-    case PANGO_ATTR_SCALE:
-      g_string_append_printf (string, "%g", ((PangoAttrFloat*)attr)->value);
-      break;
-    default:
-      g_assert_not_reached ();
-    }
-}
-
 static void
 test_file (const gchar *filename, GString *string)
 {
@@ -213,7 +115,7 @@ test_file (const gchar *filename, GString *string)
       append_text (s1, text + item->offset, item->length);
 
       g_string_append_printf (s2, "%s%s", sep, font);
-      g_string_append_printf (s3, "%s%s", sep, script_name (item->analysis.script));
+      g_string_append_printf (s3, "%s%s", sep, get_script_name (item->analysis.script));
       g_string_append_printf (s4, "%s%s", sep, pango_language_to_string (item->analysis.language));
       g_string_append_printf (s5, "%s%d", sep, item->analysis.level);
       g_string_append_printf (s6, "%s", sep);
@@ -222,7 +124,7 @@ test_file (const gchar *filename, GString *string)
           PangoAttribute *attr = a->data;
           if (a != item->analysis.extra_attrs)
             g_string_append (s6, ",");
-          append_attribute (attr, s6);
+          print_attribute (attr, s6);
         }
 
       g_free (font);
diff --git a/tests/test-layout.c b/tests/test-layout.c
index c4d01ccc..1ad3498c 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -279,17 +279,17 @@ test_file (const gchar *filename, GString *string)
   pango_layout_set_wrap (layout, wrap);
 
   g_string_append (string, pango_layout_get_text (layout));
-  g_string_append (string, "\n---\n\n");
+  g_string_append (string, "\n--- parameters\n\n");
   g_string_append_printf (string, "wrapped: %d\n", pango_layout_is_wrapped (layout));
   g_string_append_printf (string, "ellipsized: %d\n", pango_layout_is_ellipsized (layout));
   g_string_append_printf (string, "lines: %d\n", pango_layout_get_line_count (layout));
   if (width != 0)
     g_string_append_printf (string, "width: %d\n", pango_layout_get_width (layout));
-  g_string_append (string, "\n---\n\n");
+  g_string_append (string, "\n--- attributes\n\n");
   print_attr_list (pango_layout_get_attributes (layout), string);
-  g_string_append (string, "\n---\n\n");
+  g_string_append (string, "\n--- lines\n\n");
   dump_lines (layout, string);
-  g_string_append (string, "\n---\n\n");
+  g_string_append (string, "\n--- runs\n\n");
   dump_runs (layout, string);
 
   g_object_unref (layout);
diff --git a/tests/testattributes.c b/tests/testattributes.c
index f4c33f12..9e666469 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -104,9 +104,9 @@ test_list (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [0 -1] size 20\n"
-"  [0 -1] size 30\n");
+"[0,-1]size=10\n"
+"[0,-1]size=20\n"
+"[0,-1]size=30\n");
   g_string_free (s, FALSE);
   pango_attr_list_unref (list);
 
@@ -129,10 +129,10 @@ test_list (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [0 -1] size 30\n"
-"  [10 40] size 40\n"
-"  [10 20] size 20\n");
+"[0,-1]size=10\n"
+"[0,-1]size=30\n"
+"[10,40]size=40\n"
+"[10,20]size=20\n");
   g_string_free (s, FALSE);
   pango_attr_list_unref (list);
 }
@@ -162,9 +162,9 @@ test_list_change (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 10] size 10\n"
-"  [0 30] weight 700\n"
-"  [20 30] size 20\n");
+"[0,10]size=10\n"
+"[0,30]weight=700\n"
+"[20,30]size=20\n");
   g_string_free (s, FALSE);
 
   /* simple insertion with pango_attr_list_change */
@@ -176,10 +176,10 @@ test_list_change (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 10] size 10\n"
-"  [0 30] weight 700\n"
-"  [10 20] variant 1\n"
-"  [20 30] size 20\n");
+"[0,10]size=10\n"
+"[0,30]weight=700\n"
+"[10,20]variant=1\n"
+"[20,30]size=20\n");
   g_string_free (s, FALSE);
 
   /* insertion with splitting */
@@ -191,12 +191,12 @@ test_list_change (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 10] size 10\n"
-"  [0 15] weight 700\n"
-"  [10 20] variant 1\n"
-"  [15 20] weight 300\n"
-"  [20 30] size 20\n"
-"  [20 30] weight 700\n");
+"[0,10]size=10\n"
+"[0,15]weight=700\n"
+"[10,20]variant=1\n"
+"[15,20]weight=300\n"
+"[20,30]size=20\n"
+"[20,30]weight=700\n");
   g_string_free (s, FALSE);
 
   /* insertion with joining */
@@ -208,12 +208,12 @@ test_list_change (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 5] size 10\n"
-"  [0 15] weight 700\n"
-"  [5 30] size 20\n"
-"  [10 20] variant 1\n"
-"  [15 20] weight 300\n"
-"  [20 30] weight 700\n");
+"[0,5]size=10\n"
+"[0,15]weight=700\n"
+"[5,30]size=20\n"
+"[10,20]variant=1\n"
+"[15,20]weight=300\n"
+"[20,30]weight=700\n");
   g_string_free (s, FALSE);
 
   pango_attr_list_unref (list);
@@ -245,9 +245,9 @@ test_list_splice (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (base), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [10 15] weight 700\n"
-"  [20 30] variant 1\n");
+"[0,-1]size=10\n"
+"[10,15]weight=700\n"
+"[20,30]variant=1\n");
   g_string_free (s, FALSE);
 
   /* splice in an empty list */
@@ -258,9 +258,9 @@ test_list_splice (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [10 20] weight 700\n"
-"  [25 35] variant 1\n");
+"[0,-1]size=10\n"
+"[10,20]weight=700\n"
+"[25,35]variant=1\n");
   g_string_free (s, FALSE);
 
   pango_attr_list_unref (list);
@@ -283,12 +283,12 @@ test_list_splice (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 11] size 10\n"
-"  [10 20] weight 700\n"
-"  [11 14] size 20\n"
-"  [13 15] stretch 2\n"
-"  [14 -1] size 10\n"
-"  [25 35] variant 1\n");
+"[0,11]size=10\n"
+"[10,20]weight=700\n"
+"[11,14]size=20\n"
+"[13,15]stretch=2\n"
+"[14,-1]size=10\n"
+"[25,35]variant=1\n");
   g_string_free (s, FALSE);
 
   pango_attr_list_unref (list);
@@ -334,9 +334,9 @@ test_list_filter (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [10 20] stretch 2\n"
-"  [20 -1] weight 700\n");
+"[0,-1]size=10\n"
+"[10,20]stretch=2\n"
+"[20,-1]weight=700\n");
   g_string_free (s, FALSE);
 
   out = pango_attr_list_filter (list, never_true, NULL);
@@ -348,14 +348,14 @@ test_list_filter (void)
   s = g_string_new ("");
   print_attributes (attr_list_to_list (list), s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10\n"
-"  [10 20] stretch 2\n");
+"[0,-1]size=10\n"
+"[10,20]stretch=2\n");
   g_string_free (s, FALSE);
 
   s = g_string_new ("");
   print_attributes (attr_list_to_list (out), s);
   g_assert_cmpstr (s->str, ==,
-"  [20 -1] weight 700\n");
+"[20,-1]weight=700\n");
   g_string_free (s, FALSE);
 
   pango_attr_list_unref (list);
@@ -514,8 +514,8 @@ test_iter_get_font (void)
   s = g_string_new ("");
   print_attributes (attrs, s);
   g_assert_cmpstr (s->str, ==,
-"  [20 -1] rise 100\n"
-"  [20 -1] fallback 0\n");
+"[20,-1]rise=100\n"
+"[20,-1]fallback=0\n");
   g_string_free (s, FALSE);
   g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
 
@@ -560,8 +560,8 @@ test_iter_get_attrs (void)
   s = g_string_new ("");
   print_attributes (attrs, s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10240\n"
-"  [0 -1] family Times\n");
+"[0,-1]size=10240\n"
+"[0,-1]family=Times\n");
   g_string_free (s, FALSE);
   g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
 
@@ -570,10 +570,10 @@ test_iter_get_attrs (void)
   s = g_string_new ("");
   print_attributes (attrs, s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10240\n"
-"  [0 -1] family Times\n"
-"  [10 30] stretch 2\n"
-"  [10 20] language ja-jp\n");
+"[0,-1]size=10240\n"
+"[0,-1]family=Times\n"
+"[10,30]stretch=2\n"
+"[10,20]language=ja-jp\n");
   g_string_free (s, FALSE);
   g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
 
@@ -582,11 +582,11 @@ test_iter_get_attrs (void)
   s = g_string_new ("");
   print_attributes (attrs, s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10240\n"
-"  [0 -1] family Times\n"
-"  [10 30] stretch 2\n"
-"  [20 -1] rise 100\n"
-"  [20 -1] fallback 0\n");
+"[0,-1]size=10240\n"
+"[0,-1]family=Times\n"
+"[10,30]stretch=2\n"
+"[20,-1]rise=100\n"
+"[20,-1]fallback=0\n");
   g_string_free (s, FALSE);
   g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
 
@@ -595,10 +595,10 @@ test_iter_get_attrs (void)
   s = g_string_new ("");
   print_attributes (attrs, s);
   g_assert_cmpstr (s->str, ==,
-"  [0 -1] size 10240\n"
-"  [0 -1] family Times\n"
-"  [20 -1] rise 100\n"
-"  [20 -1] fallback 0\n");
+"[0,-1]size=10240\n"
+"[0,-1]family=Times\n"
+"[20,-1]rise=100\n"
+"[20,-1]fallback=0\n");
   g_string_free (s, FALSE);
   g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
 


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