From 8bafe7acec47e698c02ca7cc739e04296e967279 Mon Sep 17 00:00:00 2001 From: Tinny Ng <tng@apache.org> Date: Mon, 4 Feb 2002 20:13:01 +0000 Subject: [PATCH] Test DOM Leve 2 functions: 3. Element::hasAttribute 4. Element::hasAttributeNS 5. Node::hasAttributes 6. Node::isSupported git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173457 13f79535-47bb-0310-9956-ffa450edef68 --- tests/DOM/DOMMemTest/DOMMemTest.cpp | 50 ++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/tests/DOM/DOMMemTest/DOMMemTest.cpp b/tests/DOM/DOMMemTest/DOMMemTest.cpp index 0b08ee22c..188d7fd4a 100644 --- a/tests/DOM/DOMMemTest/DOMMemTest.cpp +++ b/tests/DOM/DOMMemTest/DOMMemTest.cpp @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2000 The Apache Software Foundation. All rights + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -1054,6 +1054,45 @@ void DOMNSTests() TESTEPILOG; + // + // isSupported test (similar to hasFeature) + // + TESTPROLOG; + { + DOM_Document doc; + doc = DOM_Document::createDocument(); + TASSERT(doc.isSupported("XML", "") == true); + TASSERT(doc.isSupported("XML", "1.0") == true); + TASSERT(doc.isSupported("XML", "2.0") == true); + TASSERT(doc.isSupported("XML", "3.0") == false); + + TASSERT(doc.isSupported("Core", "") == true); + TASSERT(doc.isSupported("coRe", "1.0") == true); + TASSERT(doc.isSupported("core", "2.0") == true); + TASSERT(doc.isSupported("cORe", "3.0") == false); + + TASSERT(doc.isSupported("Traversal", "") == true); + TASSERT(doc.isSupported("traversal", "1.0") == false); + TASSERT(doc.isSupported("TraVersal", "2.0") == true); + + TASSERT(doc.isSupported("Range", "") == true); + TASSERT(doc.isSupported("raNge", "1.0") == false); + TASSERT(doc.isSupported("RaNge", "2.0") == true); + + + TASSERT(doc.isSupported("HTML", "") == false); + TASSERT(doc.isSupported("Views", "") == false); + TASSERT(doc.isSupported("StyleSheets", "") == false); + TASSERT(doc.isSupported("CSS", "") == false); + TASSERT(doc.isSupported("CSS2", "") == false); + TASSERT(doc.isSupported("Events", "") == false); + TASSERT(doc.isSupported("UIEvents", "") == false); + TASSERT(doc.isSupported("MouseEvents", "") == false); + TASSERT(doc.isSupported("MutationEvents", "") == false); + TASSERT(doc.isSupported("HTMLEvents", "") == false); + } + TESTEPILOG; + // // CreateDocumentType // @@ -1615,6 +1654,15 @@ void DOMNSTests() TASSERT(nnm.getNamedItemNS("", "attrc") == attrc); TASSERT(nnm.getNamedItemNS("", "attra") == 0); TASSERT(nnm.getNamedItemNS("http://nsa", "attrb") == 0); + + // Test hasAttributes, hasAttribute, hasAttributeNS + TASSERT(doc.hasAttributes() == false); + TASSERT(attrc.hasAttributes() == false); + TASSERT(rootEl.hasAttributes() == true); + TASSERT(rootEl.hasAttribute("attrc") == true); + TASSERT(rootEl.hasAttribute("wrong") == false); + TASSERT(rootEl.hasAttributeNS("http://nsa", "attra") == true); + TASSERT(rootEl.hasAttributeNS("http://nsa", "wrong") == false); } TESTEPILOG; -- GitLab