trunk/resources/tests/dom3/Core/userdatahandler01.xml
changeset 0 5057afe1ec87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/resources/tests/dom3/Core/userdatahandler01.xml	Tue Apr 08 19:47:42 2008 +0000
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
+
+<!--
+
+Copyright (c) 2004 World Wide Web Consortium, 
+(Massachusetts Institute of Technology, Institut National de
+Recherche en Informatique et en Automatique, Keio University).  All 
+Rights Reserved.  This program is distributed under the W3C's Software
+Intellectual Property License.  This program is distributed in the 
+hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+PURPOSE.  
+
+See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+
+-->
+
+
+<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="userdatahandler01">
+<metadata>
+<title>userdatahandler01</title>
+<creator>Curt Arnold</creator>
+<description>
+Call setUserData on a node providing a UserDataHandler and rename the node.
+</description>
+<date qualifier="created">2004-01-16</date>
+<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent"/>
+</metadata>
+<var name="doc" type="Document"/>
+<var name="node" type="Node"/>
+<var name="pList" type="NodeList"/>
+<var name="userDataMonitor" type="UserDataMonitor"/>
+<var name="oldUserData" type="DOMUserData"/>
+<var name="elementNS" type="DOMString"/>
+<var name="newNode" type="Node"/>
+<var name="notifications" type="List"/>
+<var name="notification" type="UserDataNotification"/>
+<var name="operation" type="short"/>
+<var name="key" type="DOMString"/>
+<var name="data" type="DOMString"/>
+<var name="src" type="Node"/>
+<var name="dst" type="Node"/>
+<var name="greetingCount" type="int" value="0"/>
+<var name="salutationCount" type="int" value="0"/>
+<var name="hello" type="DOMString" value='"Hello"'/>
+<var name="mister" type="DOMString" value='"Mr."'/>
+
+<load var="doc" href="barfoo" willBeModified="true"/>
+<getElementsByTagName var="pList" obj="doc" tagname='"p"' interface="Document"/>
+<item var="node" obj="pList" index="0" interface="NodeList"/>
+<setUserData var="oldUserData" obj="node" key='"greeting"' data='hello' handler="userDataMonitor"/>
+<setUserData var="oldUserData" obj="node" key='"salutation"' data='mister' handler="userDataMonitor"/>
+<namespaceURI var="elementNS" obj="node" interface="Node"/>
+<renameNode var="newNode" obj="doc" n="node" namespaceURI="elementNS" qualifiedName='"div"'/>
+<allNotifications var="notifications" obj="userDataMonitor"/>
+<assertSize size="2" collection="notifications" id="twoNotifications"/>
+<for-each member="notification" collection="notifications">
+	<operation var="operation" obj="notification"/>
+	<assertEquals actual="operation" expected="4" ignoreCase="false" id="operationIsRename"/>
+	<key var="key" obj="notification"/>
+	<data var="data" obj="notification" interface="UserDataNotification"/>
+	<if>
+		<equals actual="key" expected='"greeting"' ignoreCase="false"/>
+		<assertEquals actual="data" expected='hello' ignoreCase="false" id="greetingDataHello"/>
+		<increment var="greetingCount" value="1"/>
+		<else>
+			<assertEquals actual="key" expected='"salutation"' ignoreCase="false" id="saluationKey"/>
+			<assertEquals actual="data" expected='mister' ignoreCase="false" id="salutationDataMr"/>
+			<increment var="salutationCount" value="1"/>
+		</else>
+	</if>
+	<src interface="UserDataNotification" var="src" obj="notification"/>
+	<assertSame actual="src" expected="node" id="srcIsNode"/>
+	<dst var="dst" obj="notification"/>
+	<if>
+		<!-- will be null if no node needs to be newly created  -->
+		<isNull obj="dst"/>
+		<assertSame actual="newNode" expected="node" id="ifDstNullRenameMustReuseNode"/>
+		<else>
+			<!-- otherwise will be same as newNode   -->
+			<assertSame actual="dst" expected="newNode" id="dstIsNewNode"/>
+		</else>
+	</if>
+</for-each>
+<assertEquals actual="greetingCount" expected="1" ignoreCase="false" id="greetingCountIs1"/>
+<assertEquals actual="salutationCount" expected="1" ignoreCase="false" id="salutationCountIs1"/>
+</test>