summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-08-14 22:43:36 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-08-14 22:58:15 -0400
commit9a2b0f07225aaf69b33494ce7de62c814cff6b59 (patch)
tree1b57488942d01c19784d3ab60bcfd96a828e94dc
parent194f4668b32a86993d969bccfed59186c08f63dd (diff)
downloadpango-9a2b0f07225aaf69b33494ce7de62c814cff6b59.tar.gz
Add some tests for markup with alpha
-rw-r--r--tests/markup-parse.c6
-rw-r--r--tests/markups/fail-2.expected1
-rw-r--r--tests/markups/fail-2.markup1
-rw-r--r--tests/markups/fail-3.expected1
-rw-r--r--tests/markups/fail-3.markup1
-rw-r--r--tests/markups/fail-4.expected1
-rw-r--r--tests/markups/fail-4.markup1
-rw-r--r--tests/markups/valid-5.expected20
-rw-r--r--tests/markups/valid-5.markup4
-rw-r--r--tests/markups/valid-6.expected23
-rw-r--r--tests/markups/valid-6.markup4
-rw-r--r--tests/markups/valid-7.expected12
-rw-r--r--tests/markups/valid-7.markup2
-rw-r--r--tests/markups/valid-8.expected24
-rw-r--r--tests/markups/valid-8.markup4
15 files changed, 105 insertions, 0 deletions
diff --git a/tests/markup-parse.c b/tests/markup-parse.c
index e9cb6a55..bd4b1634 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 00000000..3ed61e38
--- /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 00000000..013a84c4
--- /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 00000000..8a78df5d
--- /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 00000000..1cb1996d
--- /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 00000000..b3e31c78
--- /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 00000000..ab9fc03c
--- /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 00000000..d693523c
--- /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 00000000..d3bf57c7
--- /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 00000000..1886eb68
--- /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 00000000..637ba406
--- /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 00000000..b9d8acf6
--- /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 00000000..42895348
--- /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 00000000..d78b7201
--- /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 00000000..91e9aca7
--- /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>