getComputedStyle margin percentage test for CSS calc
authormikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 23:32:40 +0000 (23:32 +0000)
committermikelawther@chromium.org <mikelawther@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jan 2012 23:32:40 +0000 (23:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76130

Reviewed by Darin Adler.

Tests for future implementation of CSS3 calc() (see http://webkit.org/b/16662)

These tests are expected to 'fail', and will pass once calc() functionality is landed.
For now, they serve to demonstrate that the current code doesn't crash on these tests.

* css3/calc/getComputedStyle-margin-percentage-expected.txt: Added.
* css3/calc/getComputedStyle-margin-percentage.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105647 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/css3/calc/getComputedStyle-margin-percentage-expected.txt [new file with mode: 0644]
LayoutTests/css3/calc/getComputedStyle-margin-percentage.html [new file with mode: 0644]

index 5e8fb68..415a41e 100644 (file)
@@ -1,3 +1,18 @@
+2012-01-23  Mike Lawther  <mikelawther@chromium.org>
+
+        getComputedStyle margin percentage test for CSS calc
+        https://bugs.webkit.org/show_bug.cgi?id=76130
+
+        Reviewed by Darin Adler.
+
+        Tests for future implementation of CSS3 calc() (see http://webkit.org/b/16662)
+
+        These tests are expected to 'fail', and will pass once calc() functionality is landed.
+        For now, they serve to demonstrate that the current code doesn't crash on these tests.
+
+        * css3/calc/getComputedStyle-margin-percentage-expected.txt: Added.
+        * css3/calc/getComputedStyle-margin-percentage.html: Added.
+
 2012-01-23  Adam Barth  <abarth@webkit.org>
 
         Update the baselines for a number of tests that use gradients.  The new
diff --git a/LayoutTests/css3/calc/getComputedStyle-margin-percentage-expected.txt b/LayoutTests/css3/calc/getComputedStyle-margin-percentage-expected.txt
new file mode 100644 (file)
index 0000000..bf8a075
--- /dev/null
@@ -0,0 +1,13 @@
+Tests calling getPropertyValue on computed margin styles involving CSS calc
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL getComputedStyle(document.getElementById('calc'), null).getPropertyValue('margin-left') should be 253px. Was 0px.
+FAIL getComputedStyle(document.getElementById('calc'), null).getPropertyValue('margin-top') should be 76px. Was 0px.
+FAIL getComputedStyle(document.getElementById('calc'), null).getPropertyValue('margin-right') should be 346px. Was 0px.
+FAIL getComputedStyle(document.getElementById('calc'), null).getPropertyValue('margin-bottom') should be 530px. Was 0px.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/css3/calc/getComputedStyle-margin-percentage.html b/LayoutTests/css3/calc/getComputedStyle-margin-percentage.html
new file mode 100644 (file)
index 0000000..71b1adb
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<style>
+#control { 
+    margin-left: 33%;
+    margin-top: 10%;
+    margin-right: 45%;
+    margin-bottom: 69%;
+}
+#calc { 
+    margin-left: -webkit-calc(33%);
+    margin-top: -webkit-calc(10%);
+    margin-right: -webkit-calc(45%);
+    margin-bottom: -webkit-calc(69%);
+}
+</style>
+<div id="control"></div>
+<div id="calc"></div>
+<script>
+    function test(prop) {
+        shouldEvaluateTo("getComputedStyle(document.getElementById('calc'), null).getPropertyValue('" + prop + "')", "getComputedStyle(document.getElementById('control', null)).getPropertyValue('" + prop + "')");
+    }
+    
+    description("Tests calling getPropertyValue on computed margin styles involving CSS calc");
+    
+    test('margin-left');
+    test('margin-top');
+    test('margin-right');
+    test('margin-bottom');
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>