[pango: 6/6] Add some tests for markup with alpha



commit 9a2b0f07225aaf69b33494ce7de62c814cff6b59
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 14 22:43:36 2015 -0400

    Add some tests for markup with alpha

 tests/markup-parse.c           |    6 ++++++
 tests/markups/fail-2.expected  |    1 +
 tests/markups/fail-2.markup    |    1 +
 tests/markups/fail-3.expected  |    1 +
 tests/markups/fail-3.markup    |    1 +
 tests/markups/fail-4.expected  |    1 +
 tests/markups/fail-4.markup    |    1 +
 tests/markups/valid-5.expected |   20 ++++++++++++++++++++
 tests/markups/valid-5.markup   |    4 ++++
 tests/markups/valid-6.expected |   23 +++++++++++++++++++++++
 tests/markups/valid-6.markup   |    4 ++++
 tests/markups/valid-7.expected |   12 ++++++++++++
 tests/markups/valid-7.markup   |    2 ++
 tests/markups/valid-8.expected |   24 ++++++++++++++++++++++++
 tests/markups/valid-8.markup   |    4 ++++
 15 files changed, 105 insertions(+), 0 deletions(-)
---
diff --git a/tests/markup-parse.c b/tests/markup-parse.c
index e9cb6a5..bd4b163 100644
--- a/tests/markup-parse.c
+++ b/tests/markup-parse.c
@@ -97,6 +97,12 @@ print_attr (PangoAttribute *attr, GString *string)
     case PANGO_ATTR_GRAVITY_HINT:
       g_string_append_printf (string,"gravity-hint %d\n", ((PangoAttrInt *)attr)->value);
       break;
+    case PANGO_ATTR_FOREGROUND_ALPHA:
+      g_string_append_printf (string,"foreground-alpha %04x\n", ((PangoAttrInt *)attr)->value);
+      break;
+    case PANGO_ATTR_BACKGROUND_ALPHA:
+      g_string_append_printf (string,"background-alpha %04x\n", ((PangoAttrInt *)attr)->value);
+      break;
     default:
       g_assert_not_reached ();
       break;
diff --git a/tests/markups/fail-2.expected b/tests/markups/fail-2.expected
new file mode 100644
index 0000000..3ed61e3
--- /dev/null
+++ b/tests/markups/fail-2.expected
@@ -0,0 +1 @@
+ERROR: Value of 'foreground' attribute on <span> tag on line 1 could not be parsed; should be a color 
specification, not '#23456'
\ No newline at end of file
diff --git a/tests/markups/fail-2.markup b/tests/markups/fail-2.markup
new file mode 100644
index 0000000..013a84c
--- /dev/null
+++ b/tests/markups/fail-2.markup
@@ -0,0 +1 @@
+<span foreground="#23456">Text</span>
diff --git a/tests/markups/fail-3.expected b/tests/markups/fail-3.expected
new file mode 100644
index 0000000..8a78df5
--- /dev/null
+++ b/tests/markups/fail-3.expected
@@ -0,0 +1 @@
+ERROR: Value of 'foreground' attribute on <span> tag on line 1 could not be parsed; should be a color 
specification, not '#2222333344445555a'
\ No newline at end of file
diff --git a/tests/markups/fail-3.markup b/tests/markups/fail-3.markup
new file mode 100644
index 0000000..1cb1996
--- /dev/null
+++ b/tests/markups/fail-3.markup
@@ -0,0 +1 @@
+<span foreground="#2222333344445555a">Text</span>
diff --git a/tests/markups/fail-4.expected b/tests/markups/fail-4.expected
new file mode 100644
index 0000000..b3e31c7
--- /dev/null
+++ b/tests/markups/fail-4.expected
@@ -0,0 +1 @@
+ERROR: Value of 'underline_color' attribute on <span> tag on line 1 could not be parsed; should be a color 
specification, not '#2345'
\ No newline at end of file
diff --git a/tests/markups/fail-4.markup b/tests/markups/fail-4.markup
new file mode 100644
index 0000000..ab9fc03
--- /dev/null
+++ b/tests/markups/fail-4.markup
@@ -0,0 +1 @@
+<span underline_color="#2345">Text</span>
diff --git a/tests/markups/valid-5.expected b/tests/markups/valid-5.expected
new file mode 100644
index 0000000..d693523
--- /dev/null
+++ b/tests/markups/valid-5.expected
@@ -0,0 +1,20 @@
+Text
+Text
+Text
+Text
+
+
+---
+
+range 0 4
+[0 4] foreground #222233334444
+range 4 5
+range 5 9
+[5 9] foreground #222233334444
+range 9 10
+range 10 14
+[10 14] foreground #222233334444
+range 14 15
+range 15 19
+[15 19] foreground #222233334444
+range 19 2147483647
diff --git a/tests/markups/valid-5.markup b/tests/markups/valid-5.markup
new file mode 100644
index 0000000..d3bf57c
--- /dev/null
+++ b/tests/markups/valid-5.markup
@@ -0,0 +1,4 @@
+<span foreground="#234">Text</span>
+<span foreground="#223344">Text</span>
+<span foreground="#222333444">Text</span>
+<span foreground="#222233334444">Text</span>
diff --git a/tests/markups/valid-6.expected b/tests/markups/valid-6.expected
new file mode 100644
index 0000000..1886eb6
--- /dev/null
+++ b/tests/markups/valid-6.expected
@@ -0,0 +1,23 @@
+Text
+Text
+Text
+Text
+
+
+---
+
+range 0 4
+[0 4] foreground #222233334444
+[0 4] foreground-alpha 5555
+range 4 5
+range 5 9
+[5 9] foreground #222233334444
+[5 9] foreground-alpha 5555
+range 9 10
+range 10 14
+[10 14] foreground #222233334444
+range 14 15
+range 15 19
+[15 19] foreground #222233334444
+[15 19] foreground-alpha 5555
+range 19 2147483647
diff --git a/tests/markups/valid-6.markup b/tests/markups/valid-6.markup
new file mode 100644
index 0000000..637ba40
--- /dev/null
+++ b/tests/markups/valid-6.markup
@@ -0,0 +1,4 @@
+<span foreground="#2345">Text</span>
+<span foreground="#22334455">Text</span>
+<span foreground="#222333444">Text</span>
+<span foreground="#2222333344445555">Text</span>
diff --git a/tests/markups/valid-7.expected b/tests/markups/valid-7.expected
new file mode 100644
index 0000000..b9d8acf
--- /dev/null
+++ b/tests/markups/valid-7.expected
@@ -0,0 +1,12 @@
+Text
+Text
+
+
+---
+
+range 0 4
+[0 4] underline-color #222233334444
+range 4 5
+range 5 9
+[5 9] strikethrough-color #222233334444
+range 9 2147483647
diff --git a/tests/markups/valid-7.markup b/tests/markups/valid-7.markup
new file mode 100644
index 0000000..4289534
--- /dev/null
+++ b/tests/markups/valid-7.markup
@@ -0,0 +1,2 @@
+<span underline_color="#234">Text</span>
+<span strikethrough_color="#223344">Text</span>
diff --git a/tests/markups/valid-8.expected b/tests/markups/valid-8.expected
new file mode 100644
index 0000000..d78b720
--- /dev/null
+++ b/tests/markups/valid-8.expected
@@ -0,0 +1,24 @@
+Text
+Text
+Text
+Text
+
+
+---
+
+range 0 4
+[0 4] foreground #00000000ffff
+[0 4] foreground-alpha ffff
+range 4 5
+range 5 9
+[5 9] foreground #00000000ffff
+[5 9] foreground-alpha 7fff
+range 9 10
+range 10 14
+[10 14] background #00000000ffff
+[10 14] background-alpha 0001
+range 14 15
+range 15 19
+[15 19] background #00000000ffff
+[15 19] background-alpha 547a
+range 19 2147483647
diff --git a/tests/markups/valid-8.markup b/tests/markups/valid-8.markup
new file mode 100644
index 0000000..91e9aca
--- /dev/null
+++ b/tests/markups/valid-8.markup
@@ -0,0 +1,4 @@
+<span foreground="blue" alpha="65535">Text</span>
+<span foreground="blue" fgalpha="50%">Text</span>
+<span background="blue" background_alpha="1">Text</span>
+<span background="blue" bgalpha="33%">Text</span>


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