From 7a9d0c30b29c754fc2c14ff99714b58dee23b6b6 Mon Sep 17 00:00:00 2001 From: "rpallath%eng.sun.com" Date: Thu, 17 Feb 2000 00:54:57 +0000 Subject: [PATCH] Added getDocType_xml test case for XML for HTML it is null. modified Makefiles to reflect the same --- .../src/api/DocumentImpl_getDoctype.java | 4 +- .../src/api/DocumentImpl_getDoctype_xml.java | 123 ++++++++++++++++++ java/dom/tests/src/api/Makefile | 1 + java/dom/tests/src/api/Makefile.solaris | 1 + java/dom/tests/src/api/Makefile.win | 1 + 5 files changed, 128 insertions(+), 2 deletions(-) create mode 100755 java/dom/tests/src/api/DocumentImpl_getDoctype_xml.java diff --git a/java/dom/tests/src/api/DocumentImpl_getDoctype.java b/java/dom/tests/src/api/DocumentImpl_getDoctype.java index 44abd4dbe695..b5c9276fa188 100755 --- a/java/dom/tests/src/api/DocumentImpl_getDoctype.java +++ b/java/dom/tests/src/api/DocumentImpl_getDoctype.java @@ -81,8 +81,8 @@ public class DocumentImpl_getDoctype extends BWBaseTest implements Execution { try { DocumentType dt = d.getDoctype(); - if (dt == null) { - TestLoader.logErrPrint("Document Type is NULL.."); + if (dt != null) { + TestLoader.logErrPrint("Document Type for HTML is NULL.."); return BWBaseTest.FAILED; } else { TestLoader.logErrPrint("Document Type is " + dt.getName()); diff --git a/java/dom/tests/src/api/DocumentImpl_getDoctype_xml.java b/java/dom/tests/src/api/DocumentImpl_getDoctype_xml.java new file mode 100755 index 000000000000..a4b73dedd7a4 --- /dev/null +++ b/java/dom/tests/src/api/DocumentImpl_getDoctype_xml.java @@ -0,0 +1,123 @@ + +/* + The contents of this file are subject to the Mozilla Public + License Version 1.1 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + + The Original Code is mozilla.org code. + + The Initial Developer of the Original Code is Sun Microsystems, + Inc. Portions created by Sun are + Copyright (C) 1999 Sun Microsystems, Inc. All + Rights Reserved. + + Contributor(s): +*/ + +package org.mozilla.dom.test; + +import java.util.*; +import java.io.*; +import org.mozilla.dom.test.*; +import org.mozilla.dom.*; +import org.w3c.dom.*; + +public class DocumentImpl_getDoctype_xml extends BWBaseTest implements Execution +{ + + /** + * + *********************************************************** + * Constructor + *********************************************************** + * + */ + public DocumentImpl_getDoctype_xml() + { + } + + + /** + * + *********************************************************** + * Starting point of application + * + * @param args Array of command line arguments + * + *********************************************************** + */ + public static void main(String[] args) + { + } + + /** + *********************************************************** + * + * Execute Method + * + * @param tobj Object reference (Node/Document/...) + * @return true or false depending on whether test passed or failed. + * + *********************************************************** + */ + public boolean execute(Object tobj) + { + if (tobj == null) { + TestLoader.logPrint("Object is NULL..."); + return BWBaseTest.FAILED; + } + + String os = System.getProperty("OS"); + osRoutine(os); + + Document d = (Document)tobj; + if (d != null) + { + try { + DocumentType dt = d.getDoctype(); + if (dt == null) { + TestLoader.logErrPrint("Document Type is NULL.."); + return BWBaseTest.FAILED; + } else { + TestLoader.logErrPrint("Document Type is " + dt.getName()); + } + } catch (RuntimeException r) { + String msg = "Caught RuntimeException " + r ; + TestLoader.logErrPrint(msg); + return BWBaseTest.FAILED; + } + } else { + System.out.println("Document is NULL.."); + return BWBaseTest.FAILED; + } + + return BWBaseTest.PASSED; + } + + /** + * + *********************************************************** + * Routine where OS specific checks are made. + * + * @param os OS Name (SunOS/Linus/MacOS/...) + *********************************************************** + * + */ + private void osRoutine(String os) + { + if(os == null) return; + + os = os.trim(); + if(os.compareTo("SunOS") == 0) {} + else if(os.compareTo("Linux") == 0) {} + else if(os.compareTo("Windows") == 0) {} + else if(os.compareTo("MacOS") == 0) {} + else {} + } +} diff --git a/java/dom/tests/src/api/Makefile b/java/dom/tests/src/api/Makefile index 0c864009310a..385721e809f2 100755 --- a/java/dom/tests/src/api/Makefile +++ b/java/dom/tests/src/api/Makefile @@ -118,6 +118,7 @@ JAVAFILES= AttrImpl_getName.java \ DocumentImpl_createTextNode_String_0.java \ DocumentImpl_createTextNode_String_1.java \ DocumentImpl_getDoctype.java \ + DocumentImpl_getDoctype_xml.java \ DocumentImpl_getDocumentElement.java \ DocumentImpl_getElementById_String_0.java \ DocumentImpl_getElementById_String_1.java \ diff --git a/java/dom/tests/src/api/Makefile.solaris b/java/dom/tests/src/api/Makefile.solaris index 0c864009310a..385721e809f2 100644 --- a/java/dom/tests/src/api/Makefile.solaris +++ b/java/dom/tests/src/api/Makefile.solaris @@ -118,6 +118,7 @@ JAVAFILES= AttrImpl_getName.java \ DocumentImpl_createTextNode_String_0.java \ DocumentImpl_createTextNode_String_1.java \ DocumentImpl_getDoctype.java \ + DocumentImpl_getDoctype_xml.java \ DocumentImpl_getDocumentElement.java \ DocumentImpl_getElementById_String_0.java \ DocumentImpl_getElementById_String_1.java \ diff --git a/java/dom/tests/src/api/Makefile.win b/java/dom/tests/src/api/Makefile.win index 6d037a411a26..2ada29846a70 100644 --- a/java/dom/tests/src/api/Makefile.win +++ b/java/dom/tests/src/api/Makefile.win @@ -117,6 +117,7 @@ JAVAFILES= AttrImpl_getName.java \ DocumentImpl_createTextNode_String_0.java \ DocumentImpl_createTextNode_String_1.java \ DocumentImpl_getDoctype.java \ + DocumentImpl_getDoctype_xml.java \ DocumentImpl_getDocumentElement.java \ DocumentImpl_getElementById_String_0.java \ DocumentImpl_getElementById_String_1.java \