You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@apache.org on 2002/01/19 00:43:47 UTC

cvs commit: xml-xerces/java/tests/dom/mem Test.java

lehors      02/01/18 15:43:47

  Modified:    java/tests/dom/mem Test.java
  Log:
  added tests of DOM Level 3 isEqualNode() method
  
  Revision  Changes    Path
  1.7       +45 -2     xml-xerces/java/tests/dom/mem/Test.java
  
  Index: Test.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/tests/dom/mem/Test.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Test.java	14 Dec 2001 22:40:26 -0000	1.6
  +++ Test.java	18 Jan 2002 23:43:47 -0000	1.7
  @@ -1,4 +1,4 @@
  -/* $Id: Test.java,v 1.6 2001/12/14 22:40:26 lehors Exp $ */
  +/* $Id: Test.java,v 1.7 2002/01/18 23:43:47 lehors Exp $ */
   /*
    * The Apache Software License, Version 1.1
    * 
  @@ -125,7 +125,7 @@
   
       public static void main(String argv[])
       {
  -    System.out.print("DOM Memory Test.\n");
  +    System.out.println("DOM Memory Test...");
   
       //
       //  Test Doc01      Create a new empty document
  @@ -1328,5 +1328,48 @@
           Assertion.assert(t2.getNextSibling() == null);
       }
   
  +
  +    //
  +    // isEqualNode
  +    // Note: we rely on setTextContent to work properly, in case of errors
  +    // make sure it is the case first.
  +
  +    {
  +        DOMImplementation impl = DOMImplementationImpl.getDOMImplementation();
  +
  +        Document doc = impl.createDocument(null, "root", null);
  +        Node3 root = (Node3) doc.getDocumentElement();
  +
  +        Node3 n1 = (Node3) doc.createElement("el");
  +        n1.setTextContent("yo!");
  +
  +        Node3 n2 = (Node3) doc.createElement("el");
  +        n2.setTextContent("yo!");
  +
  +        Assertion.assert(n1.isEqualNode(n2, false) == true);
  +        Assertion.assert(n1.isEqualNode(n2, true) == true);
  +
  +        n2.setTextContent("yoyo!");
  +        Assertion.assert(n1.isEqualNode(n2, false) == true);
  +        Assertion.assert(n1.isEqualNode(n2, true) == false);
  +
  +        ((Element) n1).setAttribute("a1", "v1");
  +        ((Element) n1).setAttributeNS("uri", "a2", "v2");
  +        ((Element) n2).setAttribute("a1", "v1");
  +        ((Element) n2).setAttributeNS("uri", "a2", "v2");
  +        Assertion.assert(n1.isEqualNode(n2, false) == true);
  +
  +        ((Element) n2).setAttribute("a1", "v2");
  +        Assertion.assert(n1.isEqualNode(n2, false) == false);
  +
  +        root.appendChild(n1);
  +        root.appendChild(n2);
  +
  +        Node3 clone = (Node3) root.cloneNode(true);
  +        Assertion.assert(clone.isEqualNode(root, true) == true);
  +
  +    }
  +
  +    System.out.println("done.");
       };
   }    
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org