summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Neves <lcneves@gmail.com>2017-09-26 00:39:44 (GMT)
committer Lucas Neves <lcneves@gmail.com>2017-09-26 02:06:48 (GMT)
commitb408a298e6692e50c0c3765fd5ddfe46ac7d98a6 (patch)
tree95db5ca8550cb712e2021c87f1502194e60dfc17
parent8db8c192ebcc85d2a39132d32c3901b137b6dc47 (diff)
downloadlibcss-b408a298e6692e50c0c3765fd5ddfe46ac7d98a6.tar.gz
libcss-b408a298e6692e50c0c3765fd5ddfe46ac7d98a6.tar.bz2
Tests: Parse: Add support to display: [inline-]flex and the corresponding min-width and min-height auto default value.lcneves/flexbox
-rw-r--r--test/data/parse2/flexbox.dat50
-rw-r--r--test/dump.h53
2 files changed, 88 insertions, 15 deletions
diff --git a/test/data/parse2/flexbox.dat b/test/data/parse2/flexbox.dat
index 9e1084d..99ac2df 100644
--- a/test/data/parse2/flexbox.dat
+++ b/test/data/parse2/flexbox.dat
@@ -1661,3 +1661,53 @@
| flex-direction: column !important
| flex-wrap: nowrap !important
#reset
+
+#data
+* { display: flex; }
+#errors
+#expected
+| *
+| display: flex
+#reset
+
+#data
+* { display: inline-flex; }
+#errors
+#expected
+| *
+| display: inline-flex
+#reset
+
+#data
+* { display: flex !important; }
+#errors
+#expected
+| *
+| display: flex !important
+#reset
+
+#data
+* { display: inline-flex !important; }
+#errors
+#expected
+| *
+| display: inline-flex !important
+#reset
+
+#data
+* { min-width: auto; min-height: auto; }
+#errors
+#expected
+| *
+| min-width: auto
+| min-height: auto
+#reset
+
+#data
+* { min-width: auto !important; min-height: auto !important; }
+#errors
+#expected
+| *
+| min-width: auto !important
+| min-height: auto !important
+#reset
diff --git a/test/dump.h b/test/dump.h
index 729b0a3..64cad32 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -1734,6 +1734,12 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
case DISPLAY_NONE:
*ptr += sprintf(*ptr, "none");
break;
+ case DISPLAY_FLEX:
+ *ptr += sprintf(*ptr, "flex");
+ break;
+ case DISPLAY_INLINE_FLEX:
+ *ptr += sprintf(*ptr, "inline-flex");
+ break;
}
break;
case CSS_PROP_ELEVATION:
@@ -2161,6 +2167,31 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
break;
+ case CSS_PROP_MIN_HEIGHT:
+ case CSS_PROP_MIN_WIDTH:
+ assert(MIN_HEIGHT_SET ==
+ (enum op_min_height)
+ MIN_WIDTH_SET);
+ assert(MIN_HEIGHT_AUTO ==
+ (enum op_min_height)
+ MIN_WIDTH_AUTO);
+
+ switch (value) {
+ case MIN_HEIGHT_SET:
+ {
+ uint32_t unit;
+ css_fixed val = *((css_fixed *) bytecode);
+ ADVANCE(sizeof(val));
+ unit = *((uint32_t *) bytecode);
+ ADVANCE(sizeof(unit));
+ dump_unit(val, unit, ptr);
+ }
+ break;
+ case MIN_HEIGHT_AUTO:
+ *ptr += sprintf(*ptr, "auto");
+ break;
+ }
+ break;
case CSS_PROP_OPACITY:
switch (value) {
case OPACITY_SET:
@@ -2187,29 +2218,21 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
case CSS_PROP_PADDING_RIGHT:
case CSS_PROP_PADDING_BOTTOM:
case CSS_PROP_PADDING_LEFT:
- case CSS_PROP_MIN_HEIGHT:
- case CSS_PROP_MIN_WIDTH:
case CSS_PROP_PAUSE_AFTER:
case CSS_PROP_PAUSE_BEFORE:
case CSS_PROP_TEXT_INDENT:
- assert(MIN_HEIGHT_SET ==
- (enum op_min_height)
- MIN_WIDTH_SET);
- assert(MIN_HEIGHT_SET ==
- (enum op_min_height)
+ assert(TEXT_INDENT_SET ==
+ (enum op_text_indent)
PADDING_SET);
- assert(MIN_HEIGHT_SET ==
- (enum op_min_height)
+ assert(TEXT_INDENT_SET ==
+ (enum op_text_indent)
PAUSE_AFTER_SET);
- assert(MIN_HEIGHT_SET ==
- (enum op_min_height)
+ assert(TEXT_INDENT_SET ==
+ (enum op_text_indent)
PAUSE_BEFORE_SET);
- assert(MIN_HEIGHT_SET ==
- (enum op_min_height)
- TEXT_INDENT_SET);
switch (value) {
- case MIN_HEIGHT_SET:
+ case TEXT_INDENT_SET:
{
uint32_t unit;
css_fixed val = *((css_fixed *) bytecode);