summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-01-29 21:51:45 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-01-29 21:51:45 +0000
commit6ba000db056d7e9b70a7e154a003644046bf7e98 (patch)
tree30c43ec8543ec9cb66169721e3268ea0a7cdb76f /test
parent1b13f81b8259f4416df7b3063cb280cb977722d7 (diff)
downloadlibcss-6ba000db056d7e9b70a7e154a003644046bf7e98.tar.gz
libcss-6ba000db056d7e9b70a7e154a003644046bf7e98.tar.bz2
Add support for opacity property
svn path=/trunk/libcss/; revision=11527
Diffstat (limited to 'test')
-rw-r--r--test/data/parse/colours.dat32
-rw-r--r--test/data/select/tests1.dat22
-rw-r--r--test/dump.h12
-rw-r--r--test/dump_computed.h21
4 files changed, 87 insertions, 0 deletions
diff --git a/test/data/parse/colours.dat b/test/data/parse/colours.dat
index 0ca7a31..b7cab9c 100644
--- a/test/data/parse/colours.dat
+++ b/test/data/parse/colours.dat
@@ -56,6 +56,22 @@
| 0x00040018
#reset
+#data
+* { opacity: 0 }
+#errors
+#expected
+| 1 *
+| 0x02000063 0x00000000
+#reset
+
+#data
+* { opacity: 0.22 }
+#errors
+#expected
+| 1 *
+| 0x02000063 0x000000e1
+#reset
+
## Out-of-range rgb() parameters
#data
@@ -130,3 +146,19 @@
| 0x02000018 0x00000000
#reset
+#data
+* { opacity: -0.22 }
+#errors
+#expected
+| 1 *
+| 0x02000063 0x00000000
+#reset
+
+#data
+* { opacity: 1.22 }
+#errors
+#expected
+| 1 *
+| 0x02000063 0x00000400
+#reset
+
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 0e44641..01fe437 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -52,6 +52,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -127,6 +128,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -201,6 +203,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -275,6 +278,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -355,6 +359,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -439,6 +444,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -524,6 +530,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -595,6 +602,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -673,6 +681,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -748,6 +757,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -817,6 +827,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -887,6 +898,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -960,6 +972,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1032,6 +1045,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1110,6 +1124,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1188,6 +1203,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1266,6 +1282,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1348,6 +1365,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1429,6 +1447,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1508,6 +1527,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1586,6 +1606,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
@@ -1664,6 +1685,7 @@ max-height: none
max-width: none
min-height: 0px
min-width: 0px
+opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
diff --git a/test/dump.h b/test/dump.h
index b35832c..602530a 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -385,6 +385,7 @@ static const char *opcode_names[] = {
"width",
"word-spacing",
"z-index",
+ "opacity",
};
static void dump_css_fixed(css_fixed f, char **ptr)
@@ -1667,6 +1668,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
break;
+ case CSS_PROP_OPACITY:
+ switch (value) {
+ case OPACITY_SET:
+ {
+ css_fixed val = *((css_fixed *) bytecode);
+ ADVANCE(sizeof(val));
+ dump_number(val, ptr);
+ }
+ break;
+ }
+ break;
case CSS_PROP_PADDING_TOP:
case CSS_PROP_PADDING_RIGHT:
case CSS_PROP_PADDING_BOTTOM:
diff --git a/test/dump_computed.h b/test/dump_computed.h
index c76b17b..8315e65 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -1648,6 +1648,27 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
+ /* opacity */
+ val = css_computed_opacity(style, &len1);
+ switch (val) {
+ case CSS_OPACITY_SET:
+ wrote = snprintf(ptr, *len, "opacity: ");
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = dump_css_fixed(len1, ptr, *len);
+ ptr += wrote;
+ *len -= wrote;
+
+ wrote = snprintf(ptr, *len, "\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
/* outline-color */
val = css_computed_outline_color(style, &color);
switch (val) {