Bug 602759 part 16 - Reftest for detecting presence of transform lists; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Sun, 25 Sep 2011 22:04:47 +0100
changeset 78871 b6bb849d7c9990febb1311c8e8394e030e5684bd
parent 78870 28537c7d79b7c57fbb27d65bd9f44262e1a27eb4
child 78872 dbde35bf04e94142be687c99b026bfe31a811fa0
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs602759
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 602759 part 16 - Reftest for detecting presence of transform lists; r=jwatt
layout/reftests/svg/pattern-transform-presence-01-ref.svg
layout/reftests/svg/pattern-transform-presence-01.svg
layout/reftests/svg/reftest.list
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/pattern-transform-presence-01-ref.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 100">
+<defs>
+  <pattern id="patternRotated" width="1" height="1"
+    patternTransform="rotate(45 50 50)">
+    <rect width="50" height="50" fill="blue"/>
+    <rect x="50" width="50" height="50" fill="red"/>
+    <rect y="50" width="50" height="50" fill="red"/>
+    <rect x="50" y="50" width="50" height="50" fill="blue"/>
+  </pattern>
+  <pattern id="patternNotRotated" width="1" height="1">
+    <rect width="50" height="50" fill="blue"/>
+    <rect x="50" width="50" height="50" fill="red"/>
+    <rect y="50" width="50" height="50" fill="red"/>
+    <rect x="50" y="50" width="50" height="50" fill="blue"/>
+  </pattern>
+</defs>
+<rect width="100" height="100" stroke="black" fill="url(#patternRotated)"/>
+<g transform="translate(100)">
+  <rect width="100" height="100" stroke="black" fill="url(#patternRotated)"/>
+</g>
+<g transform="translate(200)">
+  <rect width="100" height="100" stroke="black" fill="url(#patternNotRotated)"/>
+</g>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/pattern-transform-presence-01.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+  xmlns:xlink="http://www.w3.org/1999/xlink"
+  onload="addTransform()" viewBox="0 0 300 100" class="reftest-wait">
+<!-- Test that the presence/absence of a patternTransform is correctly detected.
+
+     Details are below but, in summary, the first two squares should contain the
+     same pattern (a diagonal checkerbox) whilst the third square should contain
+     a different pattern (actually the same pattern but WITHOUT the rotation).
+     -->
+<script>
+function addTransform()
+{
+  var g = document.getElementById("patternBase");
+  var list = g.patternTransform.baseVal;
+  var t = document.documentElement.createSVGTransform();
+  t.setRotate(45,50,50);
+  list.appendItem(t);
+  document.documentElement.removeAttribute("class");
+}
+</script>
+<defs>
+  <!-- 1. The base pattern that will be referenced by others.
+       When the document loads, script will add a patternTransform to this
+       pattern. It does this using *only SVG DOM APIs* (i.e. not setAttribute)
+       so that we can test that when a transform is not specified by markup but
+       is added via the DOM we still correctly detect its presence. -->
+  <pattern id="patternBase" width="1" height="1">
+    <rect width="50" height="50" fill="blue"/>
+    <rect x="50" width="50" height="50" fill="red"/>
+    <rect y="50" width="50" height="50" fill="red"/>
+    <rect x="50" y="50" width="50" height="50" fill="blue"/>
+  </pattern>
+  <!-- 2. References the base pattern and should detect the base pattern's
+       patternTransform (added by script) and inherit it. (SVG 1.1 F2 13.3,
+       xlink:href 'Any attributes which are defined on the referenced element
+       which are not defined on this element are inherited by this element.').
+       Hence this pattern should look IDENTICAL to patternBase. -->
+  <pattern xlink:href="#patternBase" id="patternRefWithoutTransform"/>
+  <!-- 3. References the base pattern but patternTransform is defined (although
+       empty) and hence the patternTransform should NOT be inherited and this
+       pattern should look DIFFERENT to patternBase. -->
+  <pattern xlink:href="#patternBase" id="patternRefWithTransform"
+    patternTransform=""/>
+  <!-- The case of a patternTransform being supplied by animation is covered by
+       SMIL reftest anim-pattern-attr-presence-01.svg -->
+</defs>
+<rect width="100" height="100" stroke="black"
+  fill="url(#patternBase)"/>
+<g transform="translate(100)">
+  <rect width="100" height="100" stroke="black"
+    fill="url(#patternRefWithoutTransform)"/>
+</g>
+<g transform="translate(200)">
+  <rect width="100" height="100" stroke="black"
+    fill="url(#patternRefWithTransform)"/>
+</g>
+</svg>
--- a/layout/reftests/svg/reftest.list
+++ b/layout/reftests/svg/reftest.list
@@ -170,16 +170,17 @@ random-if(gtk2Widget) == objectBoundingB
 == path-04.svg pass.svg
 == path-05.svg pass.svg
 == pathLength-01.svg pass.svg
 == pathLength-02.svg pass.svg
 == pattern-invalid-01.svg pattern-invalid-01-ref.svg
 == pattern-live-01a.svg pattern-live-01-ref.svg
 == pattern-live-01b.svg pattern-live-01-ref.svg
 == pattern-live-01c.svg pattern-live-01-ref.svg
+== pattern-transform-presence-01.svg pattern-transform-presence-01-ref.svg
 == polygon-marker-01.svg pass.svg
 == polygon-points-negative-01.svg pass.svg
 == polyline-points-invalid-01.svg pass.svg
 == pseudo-classes-01.svg pass.svg
 # This test depends on :visited styles (which are asynchronous), so we run
 # it in layout/style/test/test_visited_reftests.html instead of using the
 # reftest harness.
 # == pseudo-classes-02.svg pseudo-classes-02-ref.svg