1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE svg PUBLIC
"-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
4 <!--======================================================================-->
5 <!--= Copyright 2000 World Wide Web Consortium, (Massachusetts =-->
6 <!--= Institute of Technology, Institut National de Recherche en =-->
7 <!--= Informatique et en Automatique, Keio University). All Rights =-->
8 <!--= Reserved. See http://www.w3.org/Consortium/Legal/. =-->
9 <!--======================================================================-->
10 <!-- ===================================================================== -->
11 <!-- dom-eventListener-BE-04.svg -->
12 <!-- renamed for 1.1 suite to interact-dom-01-f.svg -->
13 <!-- renamed for svgt/b to interact-dom-01-b.svg -->
14 <!-- Author : Vincent Hardy 06-08-2000 -->
15 <!-- 1.1 revision by Vincent Hardy -->
16 <!-- Revised for svgt/b: Ola Andersson Jun/26/2002 -->
17 <!--======================================================================-->
19 <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">
20 <SVGTestCase xmlns=
"http://www.w3.org/2000/02/svg/testSuite/description/">
21 <OperatorScript version=
"$Revision: 1.2 $" testname=
"interact-dom-01-b.svg">
23 Verify basic support for DOM event listener registration. The root svg element
24 has an onload handler where a click event listener is registered on group element 'Start Button'.
27 If UI events listener registration is supported (and UI events),
28 when the user clicks on the button a text node is inserted reading
"Event Listeners supported".
31 At the end of the test, the start test button in changed to pink,
32 and the click event listener is removed from the the start button.
35 Subsequent clicks on the start button should cause no effect if
36 the event listener has been removed successfully.
37 If additional lines of text appear in the document that say
"Event Listeners supported",
38 then the implementation has not successfully removed the event listener.
41 After clicking at least once on the button,
42 the rendered image should be exactly as the reference image, except for
43 differences in text display.
48 <title id=
"test-title">interact-dom-
01-b
</title>
49 <desc id=
"test-desc">Checks if DOM/ECMA Script binding is supported. Checks that the DOM API
50 supports event listener registration/unregistration.
</desc>
51 <!--======================================================================-->
52 <!--Content of Test Case follows... =====================-->
53 <!--======================================================================-->
54 <g id=
"test-body-content">
56 <script type=
"text/ecmascript"><![CDATA[
58 var svg_ns =
"http://www.w3.org/2000/svg"
65 // onload handler for top level svg element. Sets a UI event listener for
66 // the test start button.
68 function initTest(evt){
70 var target = evt.target;
71 doc = target.ownerDocument;
72 content = doc.getElementById(
"test-body-content");
74 // Get start rect and add a UI listener
75 startButton = doc.getElementById(
"startButton");
76 buttonRect = doc.getElementById(
"buttonRect");
77 startButton.addEventListener(
"click", uiEventDetected, false);
81 // click handler for 'startButton' rect element.
83 function uiEventDetected(evt) {
85 // Add an element to show that UI event was detected
87 var newText = doc.createElementNS(svg_ns, 'text');
88 newText.setAttribute('x', '
5');
89 newText.setAttribute('y', yLocation);
90 newText.setAttribute('font-size', '
40');
91 var message =
"Event Listeners supported";
92 var textContent = doc.createTextNode(message);
93 newText.appendChild(textContent);
94 content.appendChild(newText);
96 startButton.removeEventListener(
"click", uiEventDetected, false);
98 // Make start button pink
99 buttonRect.setAttribute(
"fill",
"#ff8888");
100 buttonRect.setAttribute(
"stroke",
"black");
102 // If test does not successfully remove the event listener, then
103 // a second click will cause a subsequent text string to appear
50 units
104 // below the first new text string.
105 yLocation = yLocation +
50;
110 <!-- ===================================================================== -->
111 <!-- Start button -->
112 <!-- ===================================================================== -->
114 <rect id=
"buttonRect" x=
"65" y=
"20" width=
"350" height=
"200" fill=
"#dddddd" stroke=
"black" />
115 <text font-size=
"54" x=
"120" y=
"130">Start Test
</text>
119 <text id=
"revision" x=
"10" y=
"340" font-size=
"40" stroke=
"none" fill=
"black">$Revision:
1.2 $
</text>
120 <rect id=
"test-frame" x=
"1" y=
"1" width=
"478" height=
"358" fill=
"none" stroke=
"#000000"/>