Home | History | Annotate | Download | only in core
      1 
      2 /*
      3 This Java source file was generated by test-to-java.xsl
      4 and is a derived work from the source document.
      5 The source document contained the following notice:
      6 
      7 
      8 
      9 Copyright (c) 2001-2003 World Wide Web Consortium,
     10 (Massachusetts Institute of Technology, Institut National de
     11 Recherche en Informatique et en Automatique, Keio University).  All
     12 Rights Reserved.  This program is distributed under the W3C's Software
     13 Intellectual Property License.  This program is distributed in the
     14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     16 PURPOSE.
     17 
     18 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     19 
     20 
     21 */
     22 
     23 package org.w3c.domts.level2.core;
     24 
     25 import org.w3c.dom.*;
     26 
     27 
     28 import org.w3c.domts.DOMTestCase;
     29 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     30 
     31 
     32 
     33 /**
     34  *     The "feature" parameter in the
     35  *     isSupported(feature,version)" method is the name
     36  *     of the feature and the version is the version number of the
     37  *     feature to test.   CORE is a legal value for the feature parameter
     38  *     (Test for CORE, upper case).
     39  *     Legal values for the version parameter are 1.0 and 2.0
     40  *     (Test for 1.0).
     41  *
     42  *     Retrieve the root node of the DOM document by invoking
     43  *     the "getDocumentElement()" method.   This should create a
     44  *     node object on which the "isSupported(feature,version)"
     45  *     method is invoked with "feature" equal to "CORE" and the version equal to 1.0.
     46  *     The method should return a boolean "true".
     47 * @author NIST
     48 * @author Mary Brady
     49 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a>
     50 */
     51 public final class isSupported12 extends DOMTestCase {
     52 
     53    /**
     54     * Constructor.
     55     * @param factory document factory, may not be null
     56     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     57     */
     58    public isSupported12(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     59       super(factory);
     60 
     61     //
     62     //   check if loaded documents are supported for content type
     63     //
     64     String contentType = getContentType();
     65     preload(contentType, "staff", false);
     66     }
     67 
     68    /**
     69     * Runs the test case.
     70     * @throws Throwable Any uncaught exception causes test to fail
     71     */
     72    public void runTest() throws Throwable {
     73       java.util.List features = new java.util.ArrayList();
     74       features.add("Core");
     75       features.add("XML");
     76       features.add("HTML");
     77       features.add("Views");
     78       features.add("StyleSheets");
     79       features.add("CSS");
     80       features.add("CSS2");
     81       features.add("Events");
     82       features.add("UIEvents");
     83       features.add("MouseEvents");
     84       features.add("MutationEvents");
     85       features.add("HTMLEvents");
     86       features.add("Range");
     87       features.add("Traversal");
     88       features.add("bogus.bogus.bogus");
     89 
     90       Document doc;
     91       Node rootNode;
     92       String featureElement;
     93       boolean state;
     94       doc = (Document) load("staff", false);
     95       rootNode = doc.getDocumentElement();
     96       state = rootNode.isSupported("Core", "2.0");
     97       assertTrue("Core2", state);
     98       for (int indexN10078 = 0; indexN10078 < features.size(); indexN10078++) {
     99           featureElement = (String) features.get(indexN10078);
    100     state = rootNode.isSupported(featureElement, "1.0");
    101         }
    102       for (int indexN10083 = 0; indexN10083 < features.size(); indexN10083++) {
    103           featureElement = (String) features.get(indexN10083);
    104     state = rootNode.isSupported(featureElement, "2.0");
    105         }
    106       }
    107    /**
    108     *  Gets URI that identifies the test.
    109     *  @return uri identifier of test
    110     */
    111    public String getTargetURI() {
    112       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported12";
    113    }
    114    /**
    115     * Runs this test from the command line.
    116     * @param args command line arguments
    117     */
    118    public static void main(final String[] args) {
    119         DOMTestCase.doMain(isSupported12.class, args);
    120    }
    121 }
    122 
    123