| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd"> |
| |
| <!--======================================================================--> |
| <!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =--> |
| <!--= Institute of Technology, Institut National de Recherche en =--> |
| <!--= Informatique et en Automatique, Keio University). All Rights =--> |
| <!--= Reserved. See http://www.w3.org/Consortium/Legal/. =--> |
| <!--======================================================================--> |
| <!-- ===================================================================== --> |
| <!-- dom-eventListener-BE-04.svg --> |
| <!-- renamed for 1.1 suite to interact-dom-01-f.svg --> |
| <!-- renamed for svgt/b to interact-dom-01-b.svg --> |
| <!-- Author : Vincent Hardy 06-08-2000 --> |
| <!-- 1.1 revision by Vincent Hardy --> |
| <!-- Revised for svgt/b: Ola Andersson Jun/26/2002 --> |
| <!--======================================================================--> |
| |
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" viewBox="0 0 480 360" onload="initTest(evt)" version="1.1" baseProfile="basic"> |
| <SVGTestCase xmlns="http://www.w3.org/2000/02/svg/testSuite/description/"> |
| <OperatorScript version="$Revision: 1.2 $" testname="interact-dom-01-b.svg"> |
| <Paragraph> |
| Verify basic support for DOM event listener registration. The root svg element |
| has an onload handler where a click event listener is registered on group element 'Start Button'. |
| </Paragraph> |
| <Paragraph> |
| If UI events listener registration is supported (and UI events), |
| when the user clicks on the button a text node is inserted reading "Event Listeners supported". |
| </Paragraph> |
| <Paragraph> |
| At the end of the test, the start test button in changed to pink, |
| and the click event listener is removed from the the start button. |
| </Paragraph> |
| <Paragraph> |
| Subsequent clicks on the start button should cause no effect if |
| the event listener has been removed successfully. |
| If additional lines of text appear in the document that say "Event Listeners supported", |
| then the implementation has not successfully removed the event listener. |
| </Paragraph> |
| <Paragraph> |
| After clicking at least once on the button, |
| the rendered image should be exactly as the reference image, except for |
| differences in text display. |
| </Paragraph> |
| </OperatorScript> |
| </SVGTestCase> |
| |
| <title id="test-title">interact-dom-01-b</title> |
| <desc id="test-desc">Checks if DOM/ECMA Script binding is supported. Checks that the DOM API |
| supports event listener registration/unregistration.</desc> |
| <!--======================================================================--> |
| <!--Content of Test Case follows... =====================--> |
| <!--======================================================================--> |
| <g id="test-body-content"> |
| |
| <script type="text/ecmascript"><![CDATA[ |
| |
| var svg_ns = "http://www.w3.org/2000/svg" |
| var doc; |
| var content; |
| var startButton; |
| var buttonRect; |
| var yLocation = 280; |
| // |
| // onload handler for top level svg element. Sets a UI event listener for |
| // the test start button. |
| // |
| function initTest(evt){ |
| // Get Document |
| var target = evt.target; |
| doc = target.ownerDocument; |
| content = doc.getElementById("test-body-content"); |
| |
| // Get start rect and add a UI listener |
| startButton = doc.getElementById("startButton"); |
| buttonRect = doc.getElementById("buttonRect"); |
| startButton.addEventListener("click", uiEventDetected, false); |
| } |
| |
| // |
| // click handler for 'startButton' rect element. |
| // |
| function uiEventDetected(evt) { |
| // |
| // Add an element to show that UI event was detected |
| // |
| var newText = doc.createElementNS(svg_ns, 'text'); |
| newText.setAttribute('x', '5'); |
| newText.setAttribute('y', yLocation); |
| newText.setAttribute('font-size', '40'); |
| var message = "Event Listeners supported"; |
| var textContent = doc.createTextNode(message); |
| newText.appendChild(textContent); |
| content.appendChild(newText); |
| |
| startButton.removeEventListener("click", uiEventDetected, false); |
| |
| // Make start button pink |
| buttonRect.setAttribute("fill", "#ff8888"); |
| buttonRect.setAttribute("stroke", "black"); |
| |
| // If test does not successfully remove the event listener, then |
| // a second click will cause a subsequent text string to appear 50 units |
| // below the first new text string. |
| yLocation = yLocation + 50; |
| } |
| |
| ]]></script> |
| |
| <!-- ===================================================================== --> |
| <!-- Start button --> |
| <!-- ===================================================================== --> |
| <g id="startButton"> |
| <rect id="buttonRect" x="65" y="20" width="350" height="200" fill="#dddddd" stroke="black" /> |
| <text font-size="54" x="120" y="130">Start Test</text> |
| </g> |
| |
| </g> |
| <text id="revision" x="10" y="340" font-size="40" stroke="none" fill="black">$Revision: 1.2 $</text> |
| <rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000000"/> |
| </svg> |
| |