From 37c237afc6da788f6dd6f551e611e47fcae6504f Mon Sep 17 00:00:00 2001 From: Bear Travis Date: Mon, 23 Sep 2013 17:11:55 -0700 Subject: [PATCH 1/3] Add parsing tests for basic shapes for CSS Shapes Specification --- .../basic-shapes/resources/parsing-utils.js | 43 ++++++++++++++++ .../shape-outside-circle-000.html | 25 ++++++++++ .../shape-outside-circle-001.html | 22 ++++++++ .../shape-outside-computed-circle-000.html | 25 ++++++++++ ...-outside-computed-inset-rectangle-000.html | 23 +++++++++ .../shape-outside-computed-rectangle-000.html | 23 +++++++++ .../shape-outside-computed-shape-000.html | 50 +++++++++++++++++++ .../shape-outside-computed-shape-001.html | 32 ++++++++++++ .../shape-outside-computed-shape-002.html | 49 ++++++++++++++++++ .../shape-outside-ellipse-000.html | 25 ++++++++++ .../shape-outside-ellipse-001.html | 23 +++++++++ .../shape-outside-inset-rectangle-000.html | 29 +++++++++++ .../shape-outside-inset-rectangle-001.html | 27 ++++++++++ .../shape-outside-polygon-000.html | 29 +++++++++++ .../shape-outside-rectangle-000.html | 29 +++++++++++ .../shape-outside-rectangle-001.html | 25 ++++++++++ .../shape-outside-shape-arguments-000.html | 30 +++++++++++ .../shape-outside-shape-arguments-001.html | 25 ++++++++++ .../shape-outside-shape-notation-000.html | 26 ++++++++++ 19 files changed, 560 insertions(+) create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/resources/parsing-utils.js create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-inset-rectangle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-rectangle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-001.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-notation-000.html diff --git a/contributors/adobe/submitted/shapes/basic-shapes/resources/parsing-utils.js b/contributors/adobe/submitted/shapes/basic-shapes/resources/parsing-utils.js new file mode 100644 index 0000000000..9b41de159f --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/resources/parsing-utils.js @@ -0,0 +1,43 @@ +function test_inline_style(value, expected) { + var div = document.createElement('div'); + div.style.setProperty('shape-outside', value); + var actual = div.style.getPropertyValue('shape-outside'); + assert_equals(actual, typeof expected !== 'undefined' ? expected : value); +} + +function test_computed_style(value, expected, props) { + var div = document.createElement('div'); + div.style.setProperty('shape-outside', value); + if (props) + for (key in props) + div.style.setProperty(key, props[key]); + document.body.appendChild(div); + var style = getComputedStyle(div); + var actual = style.getPropertyValue('shape-outside'); + document.body.removeChild(div); + assert_equals(actual, typeof expected !== 'undefined' ? expected : value); +} + +function test_approx_computed_style(value, expected, props) { + var div = document.createElement('div'); + div.style.setProperty('shape-outside', value); + if (props) + for (key in props) + div.style.setProperty(key, props[key]); + document.body.appendChild(div); + var numre = /[\d\.]+/g; + + var result = getComputedStyle(div).getPropertyValue('shape-outside'); + document.body.removeChild(div); + + // Is it the same except for the numbers? + assert_equals(result.replace(numre, ''), expected.replace(numre, '')); + + // Are the numbers equal? + var results = result.match(numre).map(parseFloat); + var expecteds = expected.match(numre).map(parseFloat); + assert_equals(results.length, expecteds.length); + results.forEach(function(result, i) { + assert_approx_equals(result, expecteds[i], 0.01); + }); +} diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-000.html new file mode 100644 index 0000000000..550d7edb22 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-000.html @@ -0,0 +1,25 @@ + + + + Shape Outside Circle Inline Style Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-001.html new file mode 100644 index 0000000000..8ae2d49afd --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-circle-001.html @@ -0,0 +1,22 @@ + + + + Shape Outside Circle Invalid Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html new file mode 100644 index 0000000000..7b72c15cae --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html @@ -0,0 +1,25 @@ + + + + Shape Outside Circle Percentage Lengths + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-inset-rectangle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-inset-rectangle-000.html new file mode 100644 index 0000000000..3b661071cc --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-inset-rectangle-000.html @@ -0,0 +1,23 @@ + + + + Shape Outside Inset Rectangle Computed Style + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-rectangle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-rectangle-000.html new file mode 100644 index 0000000000..78925bc0b6 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-rectangle-000.html @@ -0,0 +1,23 @@ + + + + Shape Outside Rectangle Computed Style + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html new file mode 100644 index 0000000000..0336e66c83 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html @@ -0,0 +1,50 @@ + + + + Shape Outside Basic Shape Computed Relative Lengths + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-001.html new file mode 100644 index 0000000000..721796ea82 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-001.html @@ -0,0 +1,32 @@ + + + + Shape Outside Percentages are Resolved in Computed Value + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html new file mode 100644 index 0000000000..093cd49682 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html @@ -0,0 +1,49 @@ + + + + Shape Outside Basic Shape Computed Relative to Box Sizing + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-000.html new file mode 100644 index 0000000000..c252f00e8b --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-000.html @@ -0,0 +1,25 @@ + + + + Shape Outside Circle Inline Style Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-001.html new file mode 100644 index 0000000000..744e823e72 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-ellipse-001.html @@ -0,0 +1,23 @@ + + + + Shape Outside Circle Invalid Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-000.html new file mode 100644 index 0000000000..4a959547fa --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-000.html @@ -0,0 +1,29 @@ + + + + Shape Outside Inset Rectangle Inline Style Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-001.html new file mode 100644 index 0000000000..1a299ac748 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-inset-rectangle-001.html @@ -0,0 +1,27 @@ + + + + Shape Outside Inset Rectangle Invalid Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html new file mode 100644 index 0000000000..50b6bf04e2 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html @@ -0,0 +1,29 @@ + + + + Shape Outside Polygon Inline Style Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-000.html new file mode 100644 index 0000000000..0c7adae454 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-000.html @@ -0,0 +1,29 @@ + + + + Shape Outside Rectangle Inline Style Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-001.html new file mode 100644 index 0000000000..61dee6ad24 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-rectangle-001.html @@ -0,0 +1,25 @@ + + + + Shape Outside Rectangle Invalid Arguments + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-000.html new file mode 100644 index 0000000000..e835c0d812 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-000.html @@ -0,0 +1,30 @@ + + + + Shape Outside Basic Shape Computed Relative Lengths + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-001.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-001.html new file mode 100644 index 0000000000..29fe67c714 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-arguments-001.html @@ -0,0 +1,25 @@ + + + + Shape Outside Shape Inline Style Number Values + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-notation-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-notation-000.html new file mode 100644 index 0000000000..1196cfd2d8 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-shape-notation-000.html @@ -0,0 +1,26 @@ + + + + Shape Outside Basic Shape Inline Style Functional Notation + + + + + + + + + + +
+ + + From e862d6a9834cf7d8d229f33ffc56f0072e6e29b4 Mon Sep 17 00:00:00 2001 From: Bear Travis Date: Fri, 27 Sep 2013 12:05:17 -0700 Subject: [PATCH 2/3] Fixing computed shapes tests to check for computed, not used, values --- .../shape-outside-computed-circle-000.html | 25 --------- .../shape-outside-computed-polygon-000.html | 22 ++++++++ .../shape-outside-computed-shape-000.html | 13 ++--- .../shape-outside-computed-shape-001.html | 51 +++++++++++++------ .../shape-outside-computed-shape-002.html | 46 +++++------------ 5 files changed, 78 insertions(+), 79 deletions(-) delete mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html create mode 100644 contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-polygon-000.html diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html deleted file mode 100644 index 7b72c15cae..0000000000 --- a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-circle-000.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - Shape Outside Circle Percentage Lengths - - - - - - - - - - -
- - - diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-polygon-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-polygon-000.html new file mode 100644 index 0000000000..d617bde154 --- /dev/null +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-polygon-000.html @@ -0,0 +1,22 @@ + + + + Shape Outside Polygon Computed Style + + + + + + + + + + +
+ + + diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html index 0336e66c83..39e46f0349 100644 --- a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-000.html @@ -1,11 +1,12 @@ - Shape Outside Basic Shape Computed Relative Lengths + Shape Outside Basic Shape Computed Font Relative Lengths - + + @@ -14,15 +15,15 @@
@@ -14,19 +15,37 @@
diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html index 093cd49682..e455e7e9a4 100644 --- a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-computed-shape-002.html @@ -1,11 +1,12 @@ - Shape Outside Basic Shape Computed Relative to Box Sizing + Shape Outside Basic Shape Computed Percentage Lengths - - + + + @@ -15,35 +16,16 @@
From a0be78da86ee369f934d224c580ad87537cfaf1a Mon Sep 17 00:00:00 2001 From: Bear Travis Date: Mon, 30 Sep 2013 14:17:28 -0700 Subject: [PATCH 3/3] Fixing shape name typo in polygon test --- .../shapes/basic-shapes/shape-outside-polygon-000.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html index 50b6bf04e2..682c7a4f1f 100644 --- a/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html +++ b/contributors/adobe/submitted/shapes/basic-shapes/shape-outside-polygon-000.html @@ -17,7 +17,7 @@ generate_tests(test_inline_style, [ ["Too few points", "polygon()", null], ["Clip-rule only is invalid", "polygon(evenodd)", null], - ["1 point only", "polyon(1px 2px)"], + ["1 point only", "polygon(1px 2px)"], ["Clip rule and point", "polygon(evenodd, 1px 2px)"], ["Clip rule and multiple points", "polygon(nonzero, 1px 2px, 3px 4px)"], ["Clip rule and multiple percentages", "polygon(evenodd, 1% 2%, 3% 4%)"],