mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
Added DOM Level 1 Core conformance tests, derived from W3C DOM Conf tests
This commit is contained in:
parent
6bd91d9abe
commit
ff61aec7fb
531 changed files with 58550 additions and 3 deletions
1085
tests/DOM/conformance/level1/core/alltests.hpp
Normal file
1085
tests/DOM/conformance/level1/core/alltests.hpp
Normal file
File diff suppressed because it is too large
Load diff
108
tests/DOM/conformance/level1/core/attrcreatedocumentfragment.hpp
Normal file
108
tests/DOM/conformance/level1/core/attrcreatedocumentfragment.hpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrcreatedocumentfragment
|
||||
#define test_attrcreatedocumentfragment
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Attr nodes may be associated with Element nodes contained within a DocumentFragment.
|
||||
* Create a new DocumentFragment and add a newly created Element node(with one attribute).
|
||||
* Once the element is added, its attribute should be available as an attribute associated
|
||||
* with an Element within a DocumentFragment.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrcreatedocumentfragment : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrcreatedocumentfragment(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentFragment docFragment;
|
||||
Element newOne;
|
||||
Node domesticNode;
|
||||
NamedNodeMap domesticAttr;
|
||||
Attr attrs;
|
||||
String attrName;
|
||||
Node appendedChild;
|
||||
doc = (Document) load("staff", true);
|
||||
docFragment = doc.createDocumentFragment();
|
||||
newOne = doc.createElement(SA::construct_from_utf8("newElement"));
|
||||
newOne.setAttribute(SA::construct_from_utf8("newdomestic"), SA::construct_from_utf8("Yes"));
|
||||
appendedChild = docFragment.appendChild(newOne);
|
||||
domesticNode = docFragment.getFirstChild();
|
||||
domesticAttr = domesticNode.getAttributes();
|
||||
attrs = (Attr) domesticAttr.item(0);
|
||||
attrName = attrs.getName();
|
||||
assertEquals("newdomestic", attrName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatedocumentfragment";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
109
tests/DOM/conformance/level1/core/attrcreatetextnode.hpp
Normal file
109
tests/DOM/conformance/level1/core/attrcreatetextnode.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrcreatetextnode
|
||||
#define test_attrcreatetextnode
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setValue()" method for an attribute creates a
|
||||
* Text node with the unparsed content of the string.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the fourth employee and assign the "Y&ent1;"
|
||||
* string to its value attribute. This value is not yet
|
||||
* parsed and therefore should still be the same upon
|
||||
* retrieval. This test uses the "getNamedItem(name)" method
|
||||
* from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrcreatetextnode : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrcreatetextnode(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
String value;
|
||||
doc = (Document) load("staff", true);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(3);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
streetAttr.setValue(SA::construct_from_utf8("Y&ent1;"));
|
||||
value = streetAttr.getValue();
|
||||
assertEquals("Y&ent1;", value);
|
||||
value = streetAttr.getNodeValue();
|
||||
assertEquals("Y&ent1;", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
108
tests/DOM/conformance/level1/core/attrcreatetextnode2.hpp
Normal file
108
tests/DOM/conformance/level1/core/attrcreatetextnode2.hpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrcreatetextnode2
|
||||
#define test_attrcreatetextnode2
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setNodeValue()" method for an attribute creates a
|
||||
* Text node with the unparsed content of the string.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the fourth employee and assign the "Y&ent1;"
|
||||
* string to its value attribute. This value is not yet
|
||||
* parsed and therefore should still be the same upon
|
||||
* retrieval. This test uses the "getNamedItem(name)" method
|
||||
* from the NamedNodeMap interface.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Apr/0057.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrcreatetextnode2 : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrcreatetextnode2(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
String value;
|
||||
doc = (Document) load("staff", true);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(3);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
streetAttr.setNodeValue(SA::construct_from_utf8("Y&ent1;"));
|
||||
value = streetAttr.getValue();
|
||||
assertEquals("Y&ent1;", value);
|
||||
value = streetAttr.getNodeValue();
|
||||
assertEquals("Y&ent1;", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrcreatetextnode2";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
110
tests/DOM/conformance/level1/core/attrdefaultvalue.hpp
Normal file
110
tests/DOM/conformance/level1/core/attrdefaultvalue.hpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrdefaultvalue
|
||||
#define test_attrdefaultvalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* If there is not an explicit value assigned to an attribute
|
||||
* and there is a declaration for this attribute and that
|
||||
* declaration includes a default value, then that default
|
||||
* value is the attributes default value.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the first employee and examine its
|
||||
* value. That value should be the value given the
|
||||
* attribute in the DTD file. The test uses the
|
||||
* "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrdefaultvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrdefaultvalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
String value;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
skipIfNull(streetAttr);
|
||||
value = streetAttr.getNodeValue();
|
||||
assertEquals("Yes", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrdefaultvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
102
tests/DOM/conformance/level1/core/attreffectivevalue.hpp
Normal file
102
tests/DOM/conformance/level1/core/attreffectivevalue.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attreffectivevalue
|
||||
#define test_attreffectivevalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* If an Attr is explicitly assigned any value, then that value is the attributes effective value.
|
||||
* Retrieve the attribute named "domestic" from the last child of of the first employee
|
||||
* and examine its nodeValue attribute. This test uses the "getNamedItem(name)" method
|
||||
* from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attreffectivevalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attreffectivevalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
String value;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
value = domesticAttr.getNodeValue();
|
||||
assertEquals("Yes", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attreffectivevalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
107
tests/DOM/conformance/level1/core/attrentityreplacement.hpp
Normal file
107
tests/DOM/conformance/level1/core/attrentityreplacement.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrentityreplacement
|
||||
#define test_attrentityreplacement
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getValue()" method will return the value of the
|
||||
* attribute as a string. The general entity references
|
||||
* are replaced with their values.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the fourth employee and examine the string
|
||||
* returned by the "getValue()" method. The value should
|
||||
* be set to "Yes" after the EntityReference is
|
||||
* replaced with its value. This test uses the
|
||||
* "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrentityreplacement : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrentityreplacement(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
String value;
|
||||
doc = (Document) load("staff", true);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(3);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
value = streetAttr.getValue();
|
||||
assertEquals("Yes", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrentityreplacement";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
105
tests/DOM/conformance/level1/core/attrname.hpp
Normal file
105
tests/DOM/conformance/level1/core/attrname.hpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrname
|
||||
#define test_attrname
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The getNodeName() method of an Attribute node.
|
||||
* Retrieve the attribute named street from the last
|
||||
* child of of the second employee and examine its
|
||||
* NodeName. This test uses the getNamedItem(name) method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrname : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrname(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
String name;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(1);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
name = streetAttr.getNodeName();
|
||||
assertEquals("street", name);
|
||||
name = streetAttr.getName();
|
||||
assertEquals("street", name);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrname";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
102
tests/DOM/conformance/level1/core/attrnextsiblingnull.hpp
Normal file
102
tests/DOM/conformance/level1/core/attrnextsiblingnull.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrnextsiblingnull
|
||||
#define test_attrnextsiblingnull
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getNextSibling()" method for an Attr node should return null.
|
||||
* Retrieve the attribute named "domestic" from the last child of of the
|
||||
* first employee and examine its NextSibling node. This test uses the
|
||||
* "getNamedItem(name)" method from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6AC54C2F</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrnextsiblingnull : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrnextsiblingnull(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
Node s;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
s = domesticAttr.getNextSibling();
|
||||
assertNull(s);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnextsiblingnull";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
107
tests/DOM/conformance/level1/core/attrnotspecifiedvalue.hpp
Normal file
107
tests/DOM/conformance/level1/core/attrnotspecifiedvalue.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrnotspecifiedvalue
|
||||
#define test_attrnotspecifiedvalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getSpecified()" method for an Attr node should
|
||||
* be set to false if the attribute was not explicitly given
|
||||
* a value.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the first employee and examine the value
|
||||
* returned by the "getSpecified()" method. This test uses
|
||||
* the "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrnotspecifiedvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrnotspecifiedvalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
skipIfNull(streetAttr);
|
||||
state = streetAttr.getSpecified();
|
||||
assertFalse(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
102
tests/DOM/conformance/level1/core/attrparentnodenull.hpp
Normal file
102
tests/DOM/conformance/level1/core/attrparentnodenull.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrparentnodenull
|
||||
#define test_attrparentnodenull
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getParentNode()" method for an Attr node should return null. Retrieve
|
||||
* the attribute named "domestic" from the last child of the first employee
|
||||
* and examine its parentNode attribute. This test also uses the "getNamedItem(name)"
|
||||
* method from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1060184317</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrparentnodenull : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrparentnodenull(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
Node s;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
s = domesticAttr.getParentNode();
|
||||
assertNull(s);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrparentnodenull";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
102
tests/DOM/conformance/level1/core/attrprevioussiblingnull.hpp
Normal file
102
tests/DOM/conformance/level1/core/attrprevioussiblingnull.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrprevioussiblingnull
|
||||
#define test_attrprevioussiblingnull
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getPreviousSibling()" method for an Attr node should return null.
|
||||
* Retrieve the attribute named "domestic" from the last child of of the
|
||||
* first employee and examine its PreviousSibling node. This test uses the
|
||||
* "getNamedItem(name)" method from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-640FB3C8</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrprevioussiblingnull : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrprevioussiblingnull(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
Node s;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
s = domesticAttr.getPreviousSibling();
|
||||
assertNull(s);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrprevioussiblingnull";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
110
tests/DOM/conformance/level1/core/attrremovechild1.hpp
Normal file
110
tests/DOM/conformance/level1/core/attrremovechild1.hpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrremovechild1
|
||||
#define test_attrremovechild1
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Removing a child node from an attribute in an entity reference
|
||||
* should result in an NO_MODIFICATION_ALLOWED_ERR DOMException.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrremovechild1 : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrremovechild1(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference entRef;
|
||||
Element entElement;
|
||||
Node attrNode;
|
||||
Text textNode;
|
||||
Node removedNode;
|
||||
doc = (Document) load("staff", true);
|
||||
entRef = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entRef);
|
||||
entElement = (Element) entRef.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
attrNode = entElement.getAttributeNode(SA::construct_from_utf8("domestic"));
|
||||
textNode = (Text) attrNode.getFirstChild();
|
||||
assertNotNull(textNode);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
removedNode = attrNode.removeChild(textNode);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
112
tests/DOM/conformance/level1/core/attrreplacechild1.hpp
Normal file
112
tests/DOM/conformance/level1/core/attrreplacechild1.hpp
Normal file
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrreplacechild1
|
||||
#define test_attrreplacechild1
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Replacing a child node from an attribute in an entity reference
|
||||
* should result in an NO_MODIFICATION_ALLOWED_ERR DOMException.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrreplacechild1 : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrreplacechild1(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference entRef;
|
||||
Element entElement;
|
||||
Node attrNode;
|
||||
Text textNode;
|
||||
Node removedNode;
|
||||
Node newChild;
|
||||
doc = (Document) load("staff", true);
|
||||
entRef = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entRef);
|
||||
entElement = (Element) entRef.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
attrNode = entElement.getAttributeNode(SA::construct_from_utf8("domestic"));
|
||||
textNode = (Text) attrNode.getFirstChild();
|
||||
assertNotNull(textNode);
|
||||
newChild = doc.createTextNode(SA::construct_from_utf8("Yesterday"));
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
removedNode = attrNode.replaceChild(newChild, textNode);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrreplacechild1";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,138 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrsetvaluenomodificationallowederr
|
||||
#define test_attrsetvaluenomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setValue()" method for an attribute causes the
|
||||
* DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
|
||||
* if the node is readonly.
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the "domestic" attribute
|
||||
* from the entity reference and execute the "setValue()" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474</a>
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html">http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrsetvaluenomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrsetvaluenomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node gender;
|
||||
NodeList genList;
|
||||
Node gen;
|
||||
NodeList gList;
|
||||
Node g;
|
||||
NamedNodeMap attrList;
|
||||
Attr attrNode;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
gender = genderList.item(2);
|
||||
assertNotNull(gender);
|
||||
genList = gender.getChildNodes();
|
||||
gen = genList.item(0);
|
||||
assertNotNull(gen);
|
||||
gList = gen.getChildNodes();
|
||||
g = gList.item(0);
|
||||
assertNotNull(g);
|
||||
attrList = g.getAttributes();
|
||||
assertNotNull(attrList);
|
||||
attrNode = (Attr) attrList.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
assertNotNull(attrNode);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
attrNode.setValue(SA::construct_from_utf8("newvalue"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
attrNode.setNodeValue(SA::construct_from_utf8("newvalue2"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,134 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrsetvaluenomodificationallowederrEE
|
||||
#define test_attrsetvaluenomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setValue()" method for an attribute causes the
|
||||
* DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
|
||||
* if the node is readonly.
|
||||
* Create an entity reference using document.createEntityReference()
|
||||
* Get the "domestic" attribute from the entity
|
||||
* reference and execute the "setValue()" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474</a>
|
||||
* @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html">http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrsetvaluenomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrsetvaluenomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference entRef;
|
||||
Element entElement;
|
||||
NamedNodeMap attrList;
|
||||
Node attrNode;
|
||||
Node gender;
|
||||
NodeList genderList;
|
||||
Node appendedChild;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
gender = genderList.item(2);
|
||||
assertNotNull(gender);
|
||||
entRef = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entRef);
|
||||
appendedChild = gender.appendChild(entRef);
|
||||
entElement = (Element) entRef.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
attrList = entElement.getAttributes();
|
||||
attrNode = attrList.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((Attr) /*Node */attrNode).setValue(SA::construct_from_utf8("newvalue"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
attrNode.setNodeValue(SA::construct_from_utf8("newvalue2"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
105
tests/DOM/conformance/level1/core/attrspecifiedvalue.hpp
Normal file
105
tests/DOM/conformance/level1/core/attrspecifiedvalue.hpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrspecifiedvalue
|
||||
#define test_attrspecifiedvalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getSpecified()" method for an Attr node should
|
||||
* be set to true if the attribute was explicitly given
|
||||
* a value.
|
||||
* Retrieve the attribute named "domestic" from the last
|
||||
* child of of the first employee and examine the value
|
||||
* returned by the "getSpecified()" method. This test uses
|
||||
* the "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrspecifiedvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrspecifiedvalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
state = domesticAttr.getSpecified();
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
107
tests/DOM/conformance/level1/core/attrspecifiedvaluechanged.hpp
Normal file
107
tests/DOM/conformance/level1/core/attrspecifiedvaluechanged.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrspecifiedvaluechanged
|
||||
#define test_attrspecifiedvaluechanged
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getSpecified()" method for an Attr node should return true if the
|
||||
* value of the attribute is changed.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the THIRD employee and change its
|
||||
* value to "Yes"(which is the default DTD value). This
|
||||
* should cause the "getSpecified()" method to be true.
|
||||
* This test uses the "setAttribute(name,value)" method
|
||||
* from the Element interface and the "getNamedItem(name)"
|
||||
* method from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrspecifiedvaluechanged : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrspecifiedvaluechanged(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", true);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(2);
|
||||
((Element) /*Node */testNode).setAttribute(SA::construct_from_utf8("street"), SA::construct_from_utf8("Yes"));
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
state = streetAttr.getSpecified();
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvaluechanged";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
112
tests/DOM/conformance/level1/core/attrspecifiedvalueremove.hpp
Normal file
112
tests/DOM/conformance/level1/core/attrspecifiedvalueremove.hpp
Normal file
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_attrspecifiedvalueremove
|
||||
#define test_attrspecifiedvalueremove
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* To respecify the attribute to its default value from
|
||||
* the DTD, the attribute must be deleted. This will then
|
||||
* make a new attribute available with the "getSpecified()"
|
||||
* method value set to false.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the THIRD employee and delete it. This
|
||||
* should then create a new attribute with its default
|
||||
* value and also cause the "getSpecified()" method to
|
||||
* return false.
|
||||
* This test uses the "removeAttribute(name)" method
|
||||
* from the Element interface and the "getNamedItem(name)"
|
||||
* method from the NamedNodeMap interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6D6AC0F9</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrspecifiedvalueremove : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
attrspecifiedvalueremove(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", true);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(2);
|
||||
((Element) /*Node */testNode).removeAttribute(SA::construct_from_utf8("street"));
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
assertNotNull(streetAttr);
|
||||
state = streetAttr.getSpecified();
|
||||
assertFalse(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrspecifiedvalueremove";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
104
tests/DOM/conformance/level1/core/cdatasectiongetdata.hpp
Normal file
104
tests/DOM/conformance/level1/core/cdatasectiongetdata.hpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_cdatasectiongetdata
|
||||
#define test_cdatasectiongetdata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Retrieve the last CDATASection node located inside the
|
||||
* second child of the second employee and examine its
|
||||
* content. Since the CDATASection interface inherits
|
||||
* from the CharacterData interface(via the Text node),
|
||||
* the "getData()" method can be used to access the
|
||||
* CDATA content.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class cdatasectiongetdata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
cdatasectiongetdata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList nameList;
|
||||
Node child;
|
||||
Node lastChild;
|
||||
String data;
|
||||
int nodeType;
|
||||
doc = (Document) load("staff", false);
|
||||
nameList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
child = nameList.item(1);
|
||||
lastChild = child.getLastChild();
|
||||
nodeType = (int) lastChild.getNodeType();
|
||||
assertEquals(4, nodeType);
|
||||
data = ((CharacterData) /*Node */lastChild).getData();
|
||||
assertEquals("This is an adjacent CDATASection with a reference to a tab &tab;", data);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectiongetdata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
109
tests/DOM/conformance/level1/core/cdatasectionnormalize.hpp
Normal file
109
tests/DOM/conformance/level1/core/cdatasectionnormalize.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_cdatasectionnormalize
|
||||
#define test_cdatasectionnormalize
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Adjacent CDATASection nodes cannot be merged together by
|
||||
* use of the "normalize()" method from the Element interface.
|
||||
* Retrieve second child of the second employee and invoke
|
||||
* the "normalize()" method. The Element under contains
|
||||
* two CDATASection nodes that should not be merged together
|
||||
* by the "normalize()" method.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-162CF083</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class cdatasectionnormalize : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
cdatasectionnormalize(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList nameList;
|
||||
Element lChild;
|
||||
NodeList childNodes;
|
||||
CDATASection cdataN;
|
||||
String data;
|
||||
doc = (Document) load("staff", true);
|
||||
nameList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
lChild = (Element) nameList.item(1);
|
||||
lChild.normalize();
|
||||
childNodes = lChild.getChildNodes();
|
||||
cdataN = (CDATASection) childNodes.item(1);
|
||||
assertNotNull(cdataN);
|
||||
data = cdataN.getData();
|
||||
assertEquals("This is a CDATASection with EntityReference number 2 &ent2;", data);
|
||||
cdataN = (CDATASection) childNodes.item(3);
|
||||
assertNotNull(cdataN);
|
||||
data = cdataN.getData();
|
||||
assertEquals("This is an adjacent CDATASection with a reference to a tab &tab;", data);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/cdatasectionnormalize";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
108
tests/DOM/conformance/level1/core/characterdataappenddata.hpp
Normal file
108
tests/DOM/conformance/level1/core/characterdataappenddata.hpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataappenddata
|
||||
#define test_characterdataappenddata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "appendData(arg)" method appends a string to the end
|
||||
* of the character data of the node.
|
||||
*
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee. The appendData(arg) method is
|
||||
* called with arg=", Esquire". The method should append
|
||||
* the specified data to the already existing character
|
||||
* data. The new value return by the "getLength()" method
|
||||
* should be 24.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataappenddata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataappenddata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childValue;
|
||||
int childLength;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.appendData(SA::construct_from_utf8(", Esquire"));
|
||||
childValue = child.getData();
|
||||
childLength = SA::length(childValue);
|
||||
assertEquals(24, childLength);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataappenddatagetdata
|
||||
#define test_characterdataappenddatagetdata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* On successful invocation of the "appendData(arg)"
|
||||
* method the "getData()" method provides access to the
|
||||
* concatentation of data and the specified string.
|
||||
*
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee. The appendData(arg) method is
|
||||
* called with arg=", Esquire". The method should append
|
||||
* the specified data to the already existing character
|
||||
* data. The new value return by the "getData()" method
|
||||
* should be "Margaret Martin, Esquire".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataappenddatagetdata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataappenddatagetdata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.appendData(SA::construct_from_utf8(", Esquire"));
|
||||
childData = child.getData();
|
||||
assertEquals("Margaret Martin, Esquire", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatagetdata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataappenddatanomodificationallowederr
|
||||
#define test_characterdataappenddatanomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "appendData(arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
|
||||
* DOMException if the node is readonly.
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the FIRST item
|
||||
* from the entity reference and execute the "appendData(arg)" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataappenddatanomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataappenddatanomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entElement;
|
||||
Node entElementContent;
|
||||
Node entReference;
|
||||
int nodeType;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = genderNode.getFirstChild();
|
||||
assertNotNull(entReference);
|
||||
nodeType = (int) entReference.getNodeType();
|
||||
|
||||
if (equals(1, nodeType)) {
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entReference);
|
||||
}
|
||||
entElement = entReference.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
entElementContent = entElement.getFirstChild();
|
||||
assertNotNull(entElementContent);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entElementContent).appendData(SA::construct_from_utf8("newString"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataappenddatanomodificationallowederrEE
|
||||
#define test_characterdataappenddatanomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Create an ent3 entity reference and call appendData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-32791A2F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-32791A2F</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataappenddatanomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataappenddatanomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entText;
|
||||
EntityReference entReference;
|
||||
Node appendedChild;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(entReference);
|
||||
appendedChild = genderNode.appendChild(entReference);
|
||||
entText = entReference.getFirstChild();
|
||||
assertNotNull(entText);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entText).appendData(SA::construct_from_utf8("newString"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataappenddatanomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedatabegining
|
||||
#define test_characterdatadeletedatabegining
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method removes a range of
|
||||
* characters from the node. Delete data at the beginning
|
||||
* of the character data.
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "deleteData(offset,count)"
|
||||
* method is then called with offset=0 and count=16.
|
||||
* The method should delete the characters from position
|
||||
* 0 thru position 16. The new value of the character data
|
||||
* should be "Dallas, Texas 98551".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedatabegining : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedatabegining(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.deleteData(0, 16);
|
||||
childData = child.getData();
|
||||
assertEquals("Dallas, Texas 98551", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatabegining";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
107
tests/DOM/conformance/level1/core/characterdatadeletedataend.hpp
Normal file
107
tests/DOM/conformance/level1/core/characterdatadeletedataend.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedataend
|
||||
#define test_characterdatadeletedataend
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method removes a range of
|
||||
* characters from the node. Delete data at the end
|
||||
* of the character data.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "deleteData(offset,count)"
|
||||
* method is then called with offset=30 and count=5.
|
||||
* The method should delete the characters from position
|
||||
* 30 thru position 35. The new value of the character data
|
||||
* should be "1230 North Ave. Dallas, Texas".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedataend : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedataend(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.deleteData(30, 5);
|
||||
childData = child.getData();
|
||||
assertEquals("1230 North Ave. Dallas, Texas ", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataend";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedataexceedslength
|
||||
#define test_characterdatadeletedataexceedslength
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* If the sum of the offset and count used in the
|
||||
* "deleteData(offset,count) method is greater than the
|
||||
* length of the character data then all the characters
|
||||
* from the offset to the end of the data are deleted.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "deleteData(offset,count)"
|
||||
* method is then called with offset=4 and count=50.
|
||||
* The method should delete the characters from position 4
|
||||
* to the end of the data since the offset+count(50+4)
|
||||
* is greater than the length of the character data(35).
|
||||
* The new value of the character data should be "1230".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedataexceedslength : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedataexceedslength(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.deleteData(4, 50);
|
||||
childData = child.getData();
|
||||
assertEquals("1230", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedataexceedslength";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedatagetlengthanddata
|
||||
#define test_characterdatadeletedatagetlengthanddata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* On successful invocation of the "deleteData(offset,count)"
|
||||
* method, the "getData()" and "getLength()" methods reflect
|
||||
* the changes.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "deleteData(offset,count)"
|
||||
* method is then called with offset=30 and count=5.
|
||||
* The method should delete the characters from position
|
||||
* 30 thru position 35. The new value of the character data
|
||||
* should be "1230 North Ave. Dallas, Texas" which is
|
||||
* returned by the "getData()" method and "getLength()"
|
||||
* method should return 30".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedatagetlengthanddata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedatagetlengthanddata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
int childLength;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.deleteData(30, 5);
|
||||
childData = child.getData();
|
||||
assertEquals("1230 North Ave. Dallas, Texas ", childData);
|
||||
childLength = (int) child.getLength();
|
||||
assertEquals(30, childLength);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatagetlengthanddata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedatamiddle
|
||||
#define test_characterdatadeletedatamiddle
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method removes a range of
|
||||
* characters from the node. Delete data in the middle
|
||||
* of the character data.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "deleteData(offset,count)"
|
||||
* method is then called with offset=16 and count=8.
|
||||
* The method should delete the characters from position
|
||||
* 16 thru position 24. The new value of the character data
|
||||
* should be "1230 North Ave. Texas 98551".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedatamiddle : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedatamiddle(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.deleteData(16, 8);
|
||||
childData = child.getData();
|
||||
assertEquals("1230 North Ave. Texas 98551", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatamiddle";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedatanomodificationallowederr
|
||||
#define test_characterdatadeletedatanomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method raises a NO_MODIFICATION_ALLOWED_ERR
|
||||
* DOMException if the node is readonly.
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the FIRST item
|
||||
* from the entity reference and execute the "deleteData(offset,count)" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedatanomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedatanomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entElement;
|
||||
Node entElementContent;
|
||||
int nodeType;
|
||||
Node entReference;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = genderNode.getFirstChild();
|
||||
assertNotNull(entReference);
|
||||
nodeType = (int) entReference.getNodeType();
|
||||
|
||||
if (equals(3, nodeType)) {
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entReference);
|
||||
}
|
||||
entElement = entReference.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
entElementContent = entElement.getFirstChild();
|
||||
assertNotNull(entElementContent);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entElementContent).deleteData(1, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatadeletedatanomodificationallowederrEE
|
||||
#define test_characterdatadeletedatanomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Create an ent3 entity reference and call deleteData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatadeletedatanomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatadeletedatanomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entText;
|
||||
EntityReference entReference;
|
||||
Node appendedChild;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(entReference);
|
||||
appendedChild = genderNode.appendChild(entReference);
|
||||
entText = entReference.getFirstChild();
|
||||
assertNotNull(entText);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entText).deleteData(1, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatadeletedatanomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
101
tests/DOM/conformance/level1/core/characterdatagetdata.hpp
Normal file
101
tests/DOM/conformance/level1/core/characterdatagetdata.hpp
Normal file
|
@ -0,0 +1,101 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatagetdata
|
||||
#define test_characterdatagetdata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getData()" method retrieves the character data
|
||||
* currently stored in the node.
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee and invoke the "getData()"
|
||||
* method. The method returns the character data
|
||||
* string.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatagetdata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatagetdata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
childData = child.getData();
|
||||
assertEquals("Margaret Martin", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetdata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
103
tests/DOM/conformance/level1/core/characterdatagetlength.hpp
Normal file
103
tests/DOM/conformance/level1/core/characterdatagetlength.hpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatagetlength
|
||||
#define test_characterdatagetlength
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getLength()" method returns the number of characters
|
||||
* stored in this nodes data.
|
||||
* Retrieve the character data from the second
|
||||
* child of the first employee and examine the
|
||||
* value returned by the getLength() method.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7D61178C</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatagetlength : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatagetlength(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childValue;
|
||||
int childLength;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
childValue = child.getData();
|
||||
childLength = SA::length(childValue);
|
||||
assertEquals(15, childLength);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatagetlength";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrdeletedatacountnegative
|
||||
#define test_characterdataindexsizeerrdeletedatacountnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified count
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "deleteData(offset,count)"
|
||||
* method with offset=10 and count=-3. It should raise the
|
||||
* desired exception since the count is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrdeletedatacountnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrdeletedatacountnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.deleteData(10, -3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedatacountnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrdeletedataoffsetgreater
|
||||
#define test_characterdataindexsizeerrdeletedataoffsetgreater
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is greater that the number of characters in the string.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "deleteData(offset,count)"
|
||||
* method with offset=40 and count=3. It should raise the
|
||||
* desired exception since the offset is greater than the
|
||||
* number of characters in the string.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrdeletedataoffsetgreater : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrdeletedataoffsetgreater(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.deleteData(40, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetgreater";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrdeletedataoffsetnegative
|
||||
#define test_characterdataindexsizeerrdeletedataoffsetnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "deleteData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "deleteData(offset,count)"
|
||||
* method with offset=-5 and count=3. It should raise the
|
||||
* desired exception since the offset is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrdeletedataoffsetnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrdeletedataoffsetnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.deleteData(-5, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrdeletedataoffsetnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrinsertdataoffsetgreater
|
||||
#define test_characterdataindexsizeerrinsertdataoffsetgreater
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is greater than the number of characters in the string.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its insertData"(offset,arg)"
|
||||
* method with offset=40 and arg="ABC". It should raise
|
||||
* the desired exception since the offset is greater than
|
||||
* the number of characters in the string.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrinsertdataoffsetgreater : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrinsertdataoffsetgreater(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.insertData(40, SA::construct_from_utf8("ABC"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetgreater";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrinsertdataoffsetnegative
|
||||
#define test_characterdataindexsizeerrinsertdataoffsetnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its insertData"(offset,arg)"
|
||||
* method with offset=-5 and arg="ABC". It should raise
|
||||
* the desired exception since the offset is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrinsertdataoffsetnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrinsertdataoffsetnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.insertData(-5, SA::construct_from_utf8("ABC"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrinsertdataoffsetnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrreplacedatacountnegative
|
||||
#define test_characterdataindexsizeerrreplacedatacountnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified count
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its
|
||||
* "replaceData(offset,count,arg) method with offset=10
|
||||
* and count=-3 and arg="ABC". It should raise the
|
||||
* desired exception since the count is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrreplacedatacountnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrreplacedatacountnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.replaceData(10, -3, SA::construct_from_utf8("ABC"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedatacountnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrreplacedataoffsetgreater
|
||||
#define test_characterdataindexsizeerrreplacedataoffsetgreater
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is greater than the length of the string.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its
|
||||
* "replaceData(offset,count,arg) method with offset=40
|
||||
* and count=3 and arg="ABC". It should raise the
|
||||
* desired exception since the offset is greater than the
|
||||
* length of the string.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-7C603781</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-7C603781')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrreplacedataoffsetgreater : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrreplacedataoffsetgreater(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.replaceData(40, 3, SA::construct_from_utf8("ABC"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetgreater";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,114 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrreplacedataoffsetnegative
|
||||
#define test_characterdataindexsizeerrreplacedataoffsetnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its
|
||||
* "replaceData(offset,count,arg) method with offset=-5
|
||||
* and count=3 and arg="ABC". It should raise the
|
||||
* desired exception since the offset is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrreplacedataoffsetnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrreplacedataoffsetnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
child.replaceData(-5, 3, SA::construct_from_utf8("ABC"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrreplacedataoffsetnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrsubstringcountnegative
|
||||
#define test_characterdataindexsizeerrsubstringcountnegative
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "substringData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified count
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "substringData(offset,count)
|
||||
* method with offset=10 and count=-3. It should raise the
|
||||
* desired exception since the count is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrsubstringcountnegative : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrsubstringcountnegative(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String badSubstring;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badSubstring = child.substringData(10, -3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringcountnegative";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrsubstringnegativeoffset
|
||||
#define test_characterdataindexsizeerrsubstringnegativeoffset
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "substringData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is negative.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "substringData(offset,count)
|
||||
* method with offset=-5 and count=3. It should raise the
|
||||
* desired exception since the offset is negative.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrsubstringnegativeoffset : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrsubstringnegativeoffset(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String badString;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badString = child.substringData(-5, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringnegativeoffset";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdataindexsizeerrsubstringoffsetgreater
|
||||
#define test_characterdataindexsizeerrsubstringoffsetgreater
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "substringData(offset,count)" method raises an
|
||||
* INDEX_SIZE_ERR DOMException if the specified offset
|
||||
* is greater than the number of characters in the string.
|
||||
*
|
||||
* Retrieve the character data of the last child of the
|
||||
* first employee and invoke its "substringData(offset,count)
|
||||
* method with offset=40 and count=3. It should raise the
|
||||
* desired exception since the offsets value is greater
|
||||
* than the length.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-6531BCCF')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INDEX_SIZE_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdataindexsizeerrsubstringoffsetgreater : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdataindexsizeerrsubstringoffsetgreater(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String badString;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badString = child.substringData(40, 3);
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INDEX_SIZE_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdataindexsizeerrsubstringoffsetgreater";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatainsertdatabeginning
|
||||
#define test_characterdatainsertdatabeginning
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method will insert a string
|
||||
* at the specified character offset. Insert the data at
|
||||
* the beginning of the character data.
|
||||
* Retrieve the character data from the second child of
|
||||
* the first employee. The "insertData(offset,arg)"
|
||||
* method is then called with offset=0 and arg="Mss.".
|
||||
* The method should insert the string "Mss." at position 0.
|
||||
* The new value of the character data should be
|
||||
* "Mss. Margaret Martin".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatainsertdatabeginning : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatainsertdatabeginning(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.insertData(0, SA::construct_from_utf8("Mss. "));
|
||||
childData = child.getData();
|
||||
assertEquals("Mss. Margaret Martin", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
107
tests/DOM/conformance/level1/core/characterdatainsertdataend.hpp
Normal file
107
tests/DOM/conformance/level1/core/characterdatainsertdataend.hpp
Normal file
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatainsertdataend
|
||||
#define test_characterdatainsertdataend
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method will insert a string
|
||||
* at the specified character offset. Insert the data at
|
||||
* the end of the character data.
|
||||
*
|
||||
* Retrieve the character data from the second child of
|
||||
* the first employee. The "insertData(offset,arg)"
|
||||
* method is then called with offset=15 and arg=", Esquire".
|
||||
* The method should insert the string ", Esquire" at
|
||||
* position 15. The new value of the character data should
|
||||
* be "Margaret Martin, Esquire".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatainsertdataend : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatainsertdataend(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.insertData(15, SA::construct_from_utf8(", Esquire"));
|
||||
childData = child.getData();
|
||||
assertEquals("Margaret Martin, Esquire", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdataend";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatainsertdatamiddle
|
||||
#define test_characterdatainsertdatamiddle
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method will insert a string
|
||||
* at the specified character offset. Insert the data in
|
||||
* the middle of the character data.
|
||||
*
|
||||
* Retrieve the character data from the second child of
|
||||
* the first employee. The "insertData(offset,arg)"
|
||||
* method is then called with offset=9 and arg="Ann".
|
||||
* The method should insert the string "Ann" at position 9.
|
||||
* The new value of the character data should be
|
||||
* "Margaret Ann Martin".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatainsertdatamiddle : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatainsertdatamiddle(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.insertData(9, SA::construct_from_utf8("Ann "));
|
||||
childData = child.getData();
|
||||
assertEquals("Margaret Ann Martin", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatamiddle";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatainsertdatanomodificationallowederr
|
||||
#define test_characterdatainsertdatanomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "insertData(offset,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
|
||||
* DOMException if the node is readonly.
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the FIRST item
|
||||
* from the entity reference and execute the "insertData(offset,arg)" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatainsertdatanomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatainsertdatanomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entElement;
|
||||
int nodeType;
|
||||
Node entElementContent;
|
||||
Node entReference;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = genderNode.getFirstChild();
|
||||
assertNotNull(entReference);
|
||||
nodeType = (int) entReference.getNodeType();
|
||||
|
||||
if (equals(1, nodeType)) {
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entReference);
|
||||
}
|
||||
entElement = entReference.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
entElementContent = entElement.getFirstChild();
|
||||
assertNotNull(entElementContent);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entElementContent).insertData(1, SA::construct_from_utf8("newArg"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,110 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatainsertdatanomodificationallowederrEE
|
||||
#define test_characterdatainsertdatanomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Create an ent3 entity reference and call insertData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-3EDB695F')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatainsertdatanomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatainsertdatanomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
CharacterData entText;
|
||||
EntityReference entReference;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(entReference);
|
||||
entText = (CharacterData) entReference.getFirstChild();
|
||||
assertNotNull(entText);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
entText.insertData(1, SA::construct_from_utf8("newArg"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatanomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedatabegining
|
||||
#define test_characterdatareplacedatabegining
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method replaces the
|
||||
* characters starting at the specified offset with the
|
||||
* specified string. Test for replacement in the
|
||||
* middle of the data.
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "replaceData(offset,count,arg)"
|
||||
* method is then called with offset=5 and count=5 and
|
||||
* arg="South". The method should replace characters five
|
||||
* thru 9 of the character data with "South".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedatabegining : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedatabegining(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.replaceData(0, 4, SA::construct_from_utf8("2500"));
|
||||
childData = child.getData();
|
||||
assertEquals("2500 North Ave. Dallas, Texas 98551", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatabegining";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedataend
|
||||
#define test_characterdatareplacedataend
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method replaces the
|
||||
* characters starting at the specified offset with the
|
||||
* specified string. Test for replacement at the
|
||||
* end of the data.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "replaceData(offset,count,arg)"
|
||||
* method is then called with offset=30 and count=5 and
|
||||
* arg="98665". The method should replace characters 30
|
||||
* thru 34 of the character data with "98665".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedataend : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedataend(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.replaceData(30, 5, SA::construct_from_utf8("98665"));
|
||||
childData = child.getData();
|
||||
assertEquals("1230 North Ave. Dallas, Texas 98665", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataend";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedataexceedslengthofarg
|
||||
#define test_characterdatareplacedataexceedslengthofarg
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method replaces the
|
||||
* characters starting at the specified offset with the
|
||||
* specified string. Test the situation where the length
|
||||
* of the arg string is greater than the specified offset.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "replaceData(offset,count,arg)"
|
||||
* method is then called with offset=0 and count=4 and
|
||||
* arg="260030". The method should replace characters one
|
||||
* thru four with "260030". Note that the length of the
|
||||
* specified string is greater that the specified offset.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedataexceedslengthofarg : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedataexceedslengthofarg(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.replaceData(0, 4, SA::construct_from_utf8("260030"));
|
||||
childData = child.getData();
|
||||
assertEquals("260030 North Ave. Dallas, Texas 98551", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofarg";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedataexceedslengthofdata
|
||||
#define test_characterdatareplacedataexceedslengthofdata
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* If the sum of the offset and count exceeds the length then
|
||||
* all the characters to the end of the data are replaced.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "replaceData(offset,count,arg)"
|
||||
* method is then called with offset=0 and count=50 and
|
||||
* arg="2600". The method should replace all the characters
|
||||
* with "2600". This is because the sum of the offset and
|
||||
* count exceeds the length of the character data.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedataexceedslengthofdata : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedataexceedslengthofdata(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.replaceData(0, 50, SA::construct_from_utf8("2600"));
|
||||
childData = child.getData();
|
||||
assertEquals("2600", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedataexceedslengthofdata";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedatamiddle
|
||||
#define test_characterdatareplacedatamiddle
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method replaces the
|
||||
* characters starting at the specified offset with the
|
||||
* specified string. Test for replacement in the
|
||||
* middle of the data.
|
||||
*
|
||||
* Retrieve the character data from the last child of the
|
||||
* first employee. The "replaceData(offset,count,arg)"
|
||||
* method is then called with offset=5 and count=5 and
|
||||
* arg="South". The method should replace characters five
|
||||
* thru 9 of the character data with "South".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedatamiddle : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedatamiddle(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.replaceData(5, 5, SA::construct_from_utf8("South"));
|
||||
childData = child.getData();
|
||||
assertEquals("1230 South Ave. Dallas, Texas 98551", childData);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatamiddle";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,126 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedatanomodificationallowederr
|
||||
#define test_characterdatareplacedatanomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "replaceData(offset,count,arg)" method raises a NO_MODIFICATION_ALLOWED_ERR
|
||||
* DOMException if the node is readonly.
|
||||
*
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the FIRST item
|
||||
* from the entity reference and execute the "replaceData(offset,count,arg)" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedatanomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedatanomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entElement;
|
||||
Node entElementContent;
|
||||
Node entReference;
|
||||
int nodeType;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = genderNode.getFirstChild();
|
||||
assertNotNull(entReference);
|
||||
nodeType = (int) entReference.getNodeType();
|
||||
|
||||
if (equals(1, nodeType)) {
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entReference);
|
||||
}
|
||||
entElement = entReference.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
entElementContent = entElement.getFirstChild();
|
||||
assertNotNull(entElementContent);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entElementContent).replaceData(1, 3, SA::construct_from_utf8("newArg"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatareplacedatanomodificationallowederrEE
|
||||
#define test_characterdatareplacedatanomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Create an ent3 entity reference and call replaceData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-E5CBA7FB')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-E5CBA7FB</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatareplacedatanomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatareplacedatanomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
CharacterData entText;
|
||||
EntityReference entReference;
|
||||
Node appendedNode;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(entReference);
|
||||
appendedNode = genderNode.appendChild(entReference);
|
||||
entText = (CharacterData) entReference.getFirstChild();
|
||||
assertNotNull(entText);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
entText.replaceData(1, 3, SA::construct_from_utf8("newArg"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatareplacedatanomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatasetdatanomodificationallowederr
|
||||
#define test_characterdatasetdatanomodificationallowederr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setData(data)" method raises a NO_MODIFICATION_ALLOWED_ERR
|
||||
* DOMException if the node is readonly.
|
||||
* Obtain the children of the THIRD "gender" element. The elements
|
||||
* content is an entity reference. Get the FIRST item
|
||||
* from the entity reference and execute the "setData(data)" method.
|
||||
* This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatasetdatanomodificationallowederr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatasetdatanomodificationallowederr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entElement;
|
||||
Node entElementContent;
|
||||
Node entReference;
|
||||
int nodeType;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(2);
|
||||
entReference = genderNode.getFirstChild();
|
||||
assertNotNull(entReference);
|
||||
nodeType = (int) entReference.getNodeType();
|
||||
|
||||
if (equals(1, nodeType)) {
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent4"));
|
||||
assertNotNull(entReference);
|
||||
}
|
||||
entElement = entReference.getFirstChild();
|
||||
assertNotNull(entElement);
|
||||
entElementContent = entElement.getFirstChild();
|
||||
assertNotNull(entElementContent);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entElementContent).setData(SA::construct_from_utf8("newData"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,110 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatasetdatanomodificationallowederrEE
|
||||
#define test_characterdatasetdatanomodificationallowederrEE
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Create an ent3 entity reference and call setData on a text child, should thrown a NO_MODIFICATION_ALLOWED_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-72AB8359')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
* @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederr.xml</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatasetdatanomodificationallowederrEE : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatasetdatanomodificationallowederrEE(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList genderList;
|
||||
Node genderNode;
|
||||
Node entText;
|
||||
EntityReference entReference;
|
||||
doc = (Document) load("staff", true);
|
||||
genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender"));
|
||||
genderNode = genderList.item(4);
|
||||
entReference = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(entReference);
|
||||
entText = entReference.getFirstChild();
|
||||
assertNotNull(entText);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
((CharacterData) /*Node */entText).setData(SA::construct_from_utf8("newData"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetdatanomodificationallowederrEE";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
103
tests/DOM/conformance/level1/core/characterdatasetnodevalue.hpp
Normal file
103
tests/DOM/conformance/level1/core/characterdatasetnodevalue.hpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatasetnodevalue
|
||||
#define test_characterdatasetnodevalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setNodeValue()" method changes the character data
|
||||
* currently stored in the node.
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee and invoke the "setNodeValue()"
|
||||
* method, call "getData()" and compare.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-72AB8359</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatasetnodevalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatasetnodevalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String childData;
|
||||
String childValue;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
child.setNodeValue(SA::construct_from_utf8("Marilyn Martin"));
|
||||
childData = child.getData();
|
||||
assertEquals("Marilyn Martin", childData);
|
||||
childValue = child.getNodeValue();
|
||||
assertEquals("Marilyn Martin", childValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasetnodevalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatasubstringexceedsvalue
|
||||
#define test_characterdatasubstringexceedsvalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* If the sum of the "offset" and "count" exceeds the
|
||||
* "length" then the "substringData(offset,count)" method
|
||||
* returns all the characters to the end of the data.
|
||||
*
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee and access part of the data
|
||||
* by using the substringData(offset,count) method
|
||||
* with offset=9 and count=10. The method should return
|
||||
* the substring "Martin" since offset+count > length
|
||||
* (19 > 15).
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatasubstringexceedsvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatasubstringexceedsvalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String substring;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
substring = child.substringData(9, 10);
|
||||
assertEquals("Martin", substring);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringexceedsvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_characterdatasubstringvalue
|
||||
#define test_characterdatasubstringvalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "substringData(offset,count)" method returns the
|
||||
* specified string.
|
||||
*
|
||||
* Retrieve the character data from the second child
|
||||
* of the first employee and access part of the data
|
||||
* by using the substringData(offset,count) method. The
|
||||
* method should return the specified substring starting
|
||||
* at position "offset" and extract "count" characters.
|
||||
* The method should return the string "Margaret".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class characterdatasubstringvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
characterdatasubstringvalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node nameNode;
|
||||
CharacterData child;
|
||||
String substring;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = elementList.item(0);
|
||||
child = (CharacterData) nameNode.getFirstChild();
|
||||
substring = child.substringData(0, 8);
|
||||
assertEquals("Margaret", substring);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatasubstringvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
113
tests/DOM/conformance/level1/core/commentgetcomment.hpp
Normal file
113
tests/DOM/conformance/level1/core/commentgetcomment.hpp
Normal file
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_commentgetcomment
|
||||
#define test_commentgetcomment
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* A comment is all the characters between the starting
|
||||
* '<!--' and ending '-->'
|
||||
* Retrieve the nodes of the DOM document. Search for a
|
||||
* comment node and the content is its value.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class commentgetcomment : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
commentgetcomment(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node child;
|
||||
String childName;
|
||||
String childValue;
|
||||
int commentCount = 0;
|
||||
int childType;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getChildNodes();
|
||||
for (int indexN65623 = 0; indexN65623 != elementList.getLength(); indexN65623++) {
|
||||
child = (Node) elementList.item(indexN65623);
|
||||
childType = (int) child.getNodeType();
|
||||
|
||||
if (equals(8, childType)) {
|
||||
childName = child.getNodeName();
|
||||
assertEquals("#comment", childName);
|
||||
childValue = child.getNodeValue();
|
||||
assertEquals(" This is comment number 1.", childValue);
|
||||
commentCount = commentCount + 1;
|
||||
}
|
||||
}
|
||||
assertEquals(1, commentCount);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/commentgetcomment";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
105
tests/DOM/conformance/level1/core/documentcreateattribute.hpp
Normal file
105
tests/DOM/conformance/level1/core/documentcreateattribute.hpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateattribute
|
||||
#define test_documentcreateattribute
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createAttribute(name)" method creates an Attribute
|
||||
* node of the given name.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createAttribute(name)" method. It should create a
|
||||
* new Attribute node with the given name. The name, value
|
||||
* and type of the newly created object are retrieved and
|
||||
* output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateattribute : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateattribute(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Attr newAttrNode;
|
||||
String attrValue;
|
||||
String attrName;
|
||||
int attrType;
|
||||
doc = (Document) load("staff", true);
|
||||
newAttrNode = doc.createAttribute(SA::construct_from_utf8("district"));
|
||||
attrValue = newAttrNode.getNodeValue();
|
||||
assertEquals("", attrValue);
|
||||
attrName = newAttrNode.getNodeName();
|
||||
assertEquals("district", attrName);
|
||||
attrType = (int) newAttrNode.getNodeType();
|
||||
assertEquals(2, attrType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateattribute";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
104
tests/DOM/conformance/level1/core/documentcreatecdatasection.hpp
Normal file
104
tests/DOM/conformance/level1/core/documentcreatecdatasection.hpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreatecdatasection
|
||||
#define test_documentcreatecdatasection
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createCDATASection(data)" method creates a new
|
||||
* CDATASection node whose value is the specified string.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createCDATASection(data)" method. It should create a
|
||||
* new CDATASection node whose "data" is the specified
|
||||
* string. The content, name and type are retrieved and
|
||||
* output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D26C0AF8">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D26C0AF8</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreatecdatasection : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreatecdatasection(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
CDATASection newCDATASectionNode;
|
||||
String newCDATASectionValue;
|
||||
String newCDATASectionName;
|
||||
int newCDATASectionType;
|
||||
doc = (Document) load("staff", true);
|
||||
newCDATASectionNode = doc.createCDATASection(SA::construct_from_utf8("This is a new CDATASection node"));
|
||||
newCDATASectionValue = newCDATASectionNode.getNodeValue();
|
||||
assertEquals("This is a new CDATASection node", newCDATASectionValue);
|
||||
newCDATASectionName = newCDATASectionNode.getNodeName();
|
||||
assertEquals("#cdata-section", newCDATASectionName);
|
||||
newCDATASectionType = (int) newCDATASectionNode.getNodeType();
|
||||
assertEquals(4, newCDATASectionType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecdatasection";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
103
tests/DOM/conformance/level1/core/documentcreatecomment.hpp
Normal file
103
tests/DOM/conformance/level1/core/documentcreatecomment.hpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreatecomment
|
||||
#define test_documentcreatecomment
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createComment(data)" method creates a new Comment
|
||||
* node given the specified string.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createComment(data)" method. It should create a new
|
||||
* Comment node whose "data" is the specified string.
|
||||
* The content, name and type are retrieved and output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreatecomment : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreatecomment(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Comment newCommentNode;
|
||||
String newCommentValue;
|
||||
String newCommentName;
|
||||
int newCommentType;
|
||||
doc = (Document) load("staff", true);
|
||||
newCommentNode = doc.createComment(SA::construct_from_utf8("This is a new Comment node"));
|
||||
newCommentValue = newCommentNode.getNodeValue();
|
||||
assertEquals("This is a new Comment node", newCommentValue);
|
||||
newCommentName = newCommentNode.getNodeName();
|
||||
assertEquals("#comment", newCommentName);
|
||||
newCommentType = (int) newCommentNode.getNodeType();
|
||||
assertEquals(8, newCommentType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatecomment";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreatedocumentfragment
|
||||
#define test_documentcreatedocumentfragment
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createDocumentFragment()" method creates an empty
|
||||
* DocumentFragment object.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createDocumentFragment()" method. The content, name,
|
||||
* type and value of the newly created object are output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreatedocumentfragment : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreatedocumentfragment(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentFragment newDocFragment;
|
||||
NodeList children;
|
||||
int length;
|
||||
String newDocFragmentName;
|
||||
int newDocFragmentType;
|
||||
String newDocFragmentValue;
|
||||
doc = (Document) load("staff", true);
|
||||
newDocFragment = doc.createDocumentFragment();
|
||||
children = newDocFragment.getChildNodes();
|
||||
length = (int) children.getLength();
|
||||
assertEquals(0, length);
|
||||
newDocFragmentName = newDocFragment.getNodeName();
|
||||
assertEquals("#document-fragment", newDocFragmentName);
|
||||
newDocFragmentType = (int) newDocFragment.getNodeType();
|
||||
assertEquals(11, newDocFragmentType);
|
||||
newDocFragmentValue = newDocFragment.getNodeValue();
|
||||
assertNull(newDocFragmentValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatedocumentfragment";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
104
tests/DOM/conformance/level1/core/documentcreateelement.hpp
Normal file
104
tests/DOM/conformance/level1/core/documentcreateelement.hpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateelement
|
||||
#define test_documentcreateelement
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createElement(tagName)" method creates an Element
|
||||
* of the type specified.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createElement(tagName)" method with tagName="address".
|
||||
* The method should create an instance of an Element node
|
||||
* whose tagName is "address". The NodeName, NodeType
|
||||
* and NodeValue are returned.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateelement : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateelement(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Element newElement;
|
||||
String newElementName;
|
||||
int newElementType;
|
||||
String newElementValue;
|
||||
doc = (Document) load("staff", true);
|
||||
newElement = doc.createElement(SA::construct_from_utf8("address"));
|
||||
newElementName = newElement.getNodeName();
|
||||
assertEquals("address", newElementName);
|
||||
newElementType = (int) newElement.getNodeType();
|
||||
assertEquals(1, newElementType);
|
||||
newElementValue = newElement.getNodeValue();
|
||||
assertNull(newElementValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelement";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateelementcasesensitive
|
||||
#define test_documentcreateelementcasesensitive
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The tagName parameter in the "createElement(tagName)"
|
||||
* method is case-sensitive for XML documents.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createElement(tagName)" method twice. Once for tagName
|
||||
* equal to "address" and once for tagName equal to "ADDRESS"
|
||||
* Each call should create a distinct Element node. The
|
||||
* newly created Elements are then assigned attributes
|
||||
* that are retrieved.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateelementcasesensitive : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateelementcasesensitive(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Element newElement1;
|
||||
Element newElement2;
|
||||
String attribute1;
|
||||
String attribute2;
|
||||
doc = (Document) load("staff", true);
|
||||
newElement1 = doc.createElement(SA::construct_from_utf8("ADDRESS"));
|
||||
newElement2 = doc.createElement(SA::construct_from_utf8("address"));
|
||||
newElement1.setAttribute(SA::construct_from_utf8("district"), SA::construct_from_utf8("Fort Worth"));
|
||||
newElement2.setAttribute(SA::construct_from_utf8("county"), SA::construct_from_utf8("Dallas"));
|
||||
attribute1 = newElement1.getAttribute(SA::construct_from_utf8("district"));
|
||||
attribute2 = newElement2.getAttribute(SA::construct_from_utf8("county"));
|
||||
assertEquals("Fort Worth", attribute1);
|
||||
assertEquals("Dallas", attribute2);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementcasesensitive";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateelementdefaultattr
|
||||
#define test_documentcreateelementdefaultattr
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createElement(tagName)" method creates an Element
|
||||
* of the type specified. In addition, if there are known attributes
|
||||
* with default values, Attr nodes representing them are automatically
|
||||
* created and attached to the element.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createElement(tagName)" method with tagName="address".
|
||||
* The method should create an instance of an Element node
|
||||
* whose tagName is "address". The tagName "address" has an
|
||||
* attribute with default values, therefore the newly created element
|
||||
* will have them.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateelementdefaultattr : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateelementdefaultattr(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Element newElement;
|
||||
NamedNodeMap defaultAttr;
|
||||
Node child;
|
||||
String name;
|
||||
String value;
|
||||
doc = (Document) load("staff", true);
|
||||
newElement = doc.createElement(SA::construct_from_utf8("address"));
|
||||
defaultAttr = newElement.getAttributes();
|
||||
child = defaultAttr.item(0);
|
||||
assertNotNull(child);
|
||||
name = child.getNodeName();
|
||||
assertEquals("street", name);
|
||||
value = child.getNodeValue();
|
||||
assertEquals("Yes", value);
|
||||
assertSize(1, defaultAttr);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateelementdefaultattr";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,108 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateentityreference
|
||||
#define test_documentcreateentityreference
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createEntityReference(name)" method creates an
|
||||
* EntityReferrence node.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createEntityReference(name)" method. It should create
|
||||
* a new EntityReference node for the Entity with the
|
||||
* given name. The name, value and type are retrieved and
|
||||
* output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateentityreference : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateentityreference(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference newEntRefNode;
|
||||
String entRefValue;
|
||||
String entRefName;
|
||||
int entRefType;
|
||||
doc = (Document) load("staff", true);
|
||||
newEntRefNode = doc.createEntityReference(SA::construct_from_utf8("ent1"));
|
||||
assertNotNull(newEntRefNode);
|
||||
entRefValue = newEntRefNode.getNodeValue();
|
||||
assertNull(entRefValue);
|
||||
entRefName = newEntRefNode.getNodeName();
|
||||
assertEquals("ent1", entRefName);
|
||||
entRefType = (int) newEntRefNode.getNodeType();
|
||||
assertEquals(5, entRefType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreference";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateentityreferenceknown
|
||||
#define test_documentcreateentityreferenceknown
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createEntityReference(name)" method creates an
|
||||
* EntityReference node. In addition, if the referenced entity
|
||||
* is known, the child list of the "EntityReference" node
|
||||
* is the same as the corresponding "Entity" node.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createEntityReference(name)" method. It should create
|
||||
* a new EntityReference node for the Entity with the
|
||||
* given name. The referenced entity is known, therefore the child
|
||||
* list of the "EntityReference" node is the same as the corresponding
|
||||
* "Entity" node.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateentityreferenceknown : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateentityreferenceknown(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference newEntRefNode;
|
||||
NodeList newEntRefList;
|
||||
Node child;
|
||||
String name;
|
||||
String value;
|
||||
doc = (Document) load("staff", true);
|
||||
newEntRefNode = doc.createEntityReference(SA::construct_from_utf8("ent3"));
|
||||
assertNotNull(newEntRefNode);
|
||||
newEntRefList = newEntRefNode.getChildNodes();
|
||||
assertSize(1, newEntRefList);
|
||||
child = newEntRefNode.getFirstChild();
|
||||
name = child.getNodeName();
|
||||
assertEquals("#text", name);
|
||||
value = child.getNodeValue();
|
||||
assertEquals("Texas", value);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,111 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreateprocessinginstruction
|
||||
#define test_documentcreateprocessinginstruction
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createProcessingInstruction(target,data)" method
|
||||
* creates a new ProcessingInstruction node with the
|
||||
* specified name and data string.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createProcessingInstruction(target,data)" method.
|
||||
* It should create a new PI node with the specified target
|
||||
* and data. The target, data and type are retrieved and
|
||||
* output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0020.html">http://lists.w3.org/Archives/Public/www-dom-ts/2001Apr/0020.html</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreateprocessinginstruction : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreateprocessinginstruction(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
ProcessingInstruction newPINode;
|
||||
String piValue;
|
||||
String piName;
|
||||
int piType;
|
||||
doc = (Document) load("staff", true);
|
||||
newPINode = doc.createProcessingInstruction(SA::construct_from_utf8("TESTPI"), SA::construct_from_utf8("This is a new PI node"));
|
||||
assertNotNull(newPINode);
|
||||
piName = newPINode.getNodeName();
|
||||
assertEquals("TESTPI", piName);
|
||||
piValue = newPINode.getNodeValue();
|
||||
assertEquals("This is a new PI node", piValue);
|
||||
piType = (int) newPINode.getNodeType();
|
||||
assertEquals(7, piType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateprocessinginstruction";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
103
tests/DOM/conformance/level1/core/documentcreatetextnode.hpp
Normal file
103
tests/DOM/conformance/level1/core/documentcreatetextnode.hpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentcreatetextnode
|
||||
#define test_documentcreatetextnode
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createTextNode(data)" method creates a Text node
|
||||
* given the specfied string.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createTextNode(data)" method. It should create a
|
||||
* new Text node whose "data" is the specified string.
|
||||
* The NodeName and NodeType are also checked.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentcreatetextnode : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentcreatetextnode(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Text newTextNode;
|
||||
String newTextName;
|
||||
String newTextValue;
|
||||
int newTextType;
|
||||
doc = (Document) load("staff", true);
|
||||
newTextNode = doc.createTextNode(SA::construct_from_utf8("This is a new Text node"));
|
||||
newTextValue = newTextNode.getNodeValue();
|
||||
assertEquals("This is a new Text node", newTextValue);
|
||||
newTextName = newTextNode.getNodeName();
|
||||
assertEquals("#text", newTextName);
|
||||
newTextType = (int) newTextNode.getNodeType();
|
||||
assertEquals(3, newTextType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreatetextnode";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
109
tests/DOM/conformance/level1/core/documentgetdoctype.hpp
Normal file
109
tests/DOM/conformance/level1/core/documentgetdoctype.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetdoctype
|
||||
#define test_documentgetdoctype
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getDoctype()" method returns the Document
|
||||
* Type Declaration associated with this document.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "getDoctype()" method. The name of the document
|
||||
* type should be returned. The "getName()" method
|
||||
* should be equal to "staff" or "svg".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetdoctype : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetdoctype(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
String docTypeName;
|
||||
String nodeValue;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
docTypeName = docType.getName();
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertEquals("svg", docTypeName);
|
||||
} else {
|
||||
assertEquals("staff", docTypeName);
|
||||
}
|
||||
|
||||
nodeValue = docType.getNodeValue();
|
||||
assertNull(nodeValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctype";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetdoctypenodtd
|
||||
#define test_documentgetdoctypenodtd
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getDoctype()" method returns null for XML documents
|
||||
* without a document type declaration.
|
||||
* Retrieve the XML document without a DTD and invoke the
|
||||
* "getDoctype()" method. It should return null.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetdoctypenodtd : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetdoctypenodtd(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "hc_nodtdstaff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
doc = (Document) load("hc_nodtdstaff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNull(docType);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetdoctypenodtd";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetelementsbytagnamelength
|
||||
#define test_documentgetelementsbytagnamelength
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getElementsByTagName(tagName)" method returns a
|
||||
* NodeList of all the Elements with a given tagName.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "getElementsByTagName(tagName)" method with tagName
|
||||
* equal to "name". The method should return a NodeList
|
||||
* that contains 5 elements.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetelementsbytagnamelength : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetelementsbytagnamelength(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList nameList;
|
||||
doc = (Document) load("staff", false);
|
||||
nameList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
assertSize(5, nameList);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamelength";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetelementsbytagnametotallength
|
||||
#define test_documentgetelementsbytagnametotallength
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Retrieve the entire DOM document, invoke
|
||||
* getElementsByTagName("*") and check the length of the NodeList.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetelementsbytagnametotallength : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetelementsbytagnametotallength(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList nameList;
|
||||
doc = (Document) load("staff", false);
|
||||
nameList = doc.getElementsByTagName(SA::construct_from_utf8("*"));
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertSize(39, nameList);
|
||||
} else {
|
||||
assertSize(37, nameList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnametotallength";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetelementsbytagnamevalue
|
||||
#define test_documentgetelementsbytagnamevalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getElementsByTagName(tagName)" method returns a
|
||||
* NodeList of all the Elements with a given tagName
|
||||
* in a pre-order traversal of the tree.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "getElementsByTagName(tagName)" method with tagName
|
||||
* equal to "name". The method should return a NodeList
|
||||
* that contains 5 elements. The FOURTH item in the
|
||||
* list is retrieved and output.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetelementsbytagnamevalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetelementsbytagnamevalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList nameList;
|
||||
Node nameNode;
|
||||
Node firstChild;
|
||||
String childValue;
|
||||
doc = (Document) load("staff", false);
|
||||
nameList = doc.getElementsByTagName(SA::construct_from_utf8("name"));
|
||||
nameNode = nameList.item(3);
|
||||
firstChild = nameNode.getFirstChild();
|
||||
childValue = firstChild.getNodeValue();
|
||||
assertEquals("Jeny Oconnor", childValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetelementsbytagnamevalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetimplementation
|
||||
#define test_documentgetimplementation
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getImplementation()" method returns the
|
||||
* DOMImplementation object that handles this document.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "getImplementation()" method. It should return a
|
||||
* DOMImplementation whose "hasFeature("XML","1.0")
|
||||
* method returns the boolean value "true".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1B793EBA</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetimplementation : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetimplementation(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DOMImplementation docImpl;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", false);
|
||||
docImpl = doc.getImplementation();
|
||||
state = docImpl.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8("1.0"));
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetimplementation";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
103
tests/DOM/conformance/level1/core/documentgetrootnode.hpp
Normal file
103
tests/DOM/conformance/level1/core/documentgetrootnode.hpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentgetrootnode
|
||||
#define test_documentgetrootnode
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getDocumentElement()" method provides direct access
|
||||
* to the child node that is the root element of the document.
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "getDocumentElement()" method. It should return an
|
||||
* Element node whose NodeName is "staff" (or "svg").
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-87CD092</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=251">http://www.w3.org/Bugs/Public/show_bug.cgi?id=251</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentgetrootnode : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentgetrootnode(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Element root;
|
||||
String rootName;
|
||||
doc = (Document) load("staff", false);
|
||||
root = doc.getDocumentElement();
|
||||
rootName = root.getNodeName();
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertEquals("svg", rootName);
|
||||
} else {
|
||||
assertEquals("staff", rootName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentgetrootnode";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreateattribute
|
||||
#define test_documentinvalidcharacterexceptioncreateattribute
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createAttribute(tagName)" method raises an
|
||||
* INVALID_CHARACTER_ERR DOMException if the specified
|
||||
* tagName contains an invalid character.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createAttribute(tagName)" method with the tagName equal
|
||||
* to the string "invalid^Name". Due to the invalid
|
||||
* character the desired EXCEPTION should be raised.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1084891198')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreateattribute : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreateattribute(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Attr createdAttr;
|
||||
doc = (Document) load("staff", true);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
createdAttr = doc.createAttribute(SA::construct_from_utf8("invalid^Name"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateattribute";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2003 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreateelement
|
||||
#define test_documentinvalidcharacterexceptioncreateelement
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createElement(tagName)" method raises an
|
||||
* INVALID_CHARACTER_ERR DOMException if the specified
|
||||
* tagName contains an invalid character.
|
||||
*
|
||||
* Retrieve the entire DOM document and invoke its
|
||||
* "createElement(tagName)" method with the tagName equal
|
||||
* to the string "invalid^Name". Due to the invalid
|
||||
* character the desired EXCEPTION should be raised.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreateelement : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreateelement(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
Element badElement;
|
||||
doc = (Document) load("staff", true);
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badElement = doc.createElement(SA::construct_from_utf8("invalid^Name"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateelement";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,118 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreateentref
|
||||
#define test_documentinvalidcharacterexceptioncreateentref
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createEntityReference(tagName)" method raises an
|
||||
* INVALID_CHARACTER_ERR DOMException if the specified
|
||||
* tagName contains an invalid character.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreateentref : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreateentref(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "hc_staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference badEntityRef;
|
||||
doc = (Document) load("hc_staff", true);
|
||||
|
||||
if (("text/html" == getContentType())) {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badEntityRef = doc.createEntityReference(SA::construct_from_utf8("foo"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NOT_SUPPORTED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
} else {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badEntityRef = doc.createEntityReference(SA::construct_from_utf8("invalid^Name"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreateentref1
|
||||
#define test_documentinvalidcharacterexceptioncreateentref1
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Creating an entity reference with an empty name should cause an INVALID_CHARACTER_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=525">http://www.w3.org/Bugs/Public/show_bug.cgi?id=525</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreateentref1 : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreateentref1(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "hc_staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
EntityReference badEntityRef;
|
||||
doc = (Document) load("hc_staff", true);
|
||||
|
||||
if (("text/html" == getContentType())) {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badEntityRef = doc.createEntityReference(SA::construct_from_utf8("foo"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NOT_SUPPORTED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
} else {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badEntityRef = doc.createEntityReference(SA::construct_from_utf8(""));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreateentref1";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,118 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreatepi
|
||||
#define test_documentinvalidcharacterexceptioncreatepi
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "createProcessingInstruction(target,data) method
|
||||
* raises an INVALID_CHARACTER_ERR DOMException if the
|
||||
* specified tagName contains an invalid character.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=249">http://www.w3.org/Bugs/Public/show_bug.cgi?id=249</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreatepi : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreatepi(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "hc_staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
ProcessingInstruction badPI;
|
||||
doc = (Document) load("hc_staff", true);
|
||||
|
||||
if (("text/html" == getContentType())) {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction(SA::construct_from_utf8("foo"), SA::construct_from_utf8("data"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NOT_SUPPORTED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
} else {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction(SA::construct_from_utf8("invalid^Name"), SA::construct_from_utf8("data"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,115 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documentinvalidcharacterexceptioncreatepi1
|
||||
#define test_documentinvalidcharacterexceptioncreatepi1
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR.
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
|
||||
* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=525">http://www.w3.org/Bugs/Public/show_bug.cgi?id=525</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documentinvalidcharacterexceptioncreatepi1 : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documentinvalidcharacterexceptioncreatepi1(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "hc_staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
ProcessingInstruction badPI;
|
||||
doc = (Document) load("hc_staff", true);
|
||||
|
||||
if (("text/html" == getContentType())) {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction(SA::construct_from_utf8("foo"), SA::construct_from_utf8("data"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::NOT_SUPPORTED_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
} else {
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
try {
|
||||
badPI = doc.createProcessingInstruction(SA::construct_from_utf8(""), SA::construct_from_utf8("data"));
|
||||
} catch (const DOMException& ex) {
|
||||
success = (ex.code() == DOMException::INVALID_CHARACTER_ERR);
|
||||
}
|
||||
assertTrue(success);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentinvalidcharacterexceptioncreatepi1";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
104
tests/DOM/conformance/level1/core/documenttypegetdoctype.hpp
Normal file
104
tests/DOM/conformance/level1/core/documenttypegetdoctype.hpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetdoctype
|
||||
#define test_documenttypegetdoctype
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getName()" method contains the name of the DTD.
|
||||
*
|
||||
* Retrieve the Document Type for this document and examine
|
||||
* the string returned by the "getName()" method.
|
||||
* It should be set to "staff".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31</a>
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1844763134">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1844763134</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetdoctype : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetdoctype(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
String name;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
name = docType.getName();
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertEquals("svg", name);
|
||||
} else {
|
||||
assertEquals("staff", name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetdoctype";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
131
tests/DOM/conformance/level1/core/documenttypegetentities.hpp
Normal file
131
tests/DOM/conformance/level1/core/documenttypegetentities.hpp
Normal file
|
@ -0,0 +1,131 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetentities
|
||||
#define test_documenttypegetentities
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getEntities()" method is a NamedNodeMap that contains
|
||||
* the general entities for this document.
|
||||
*
|
||||
* Retrieve the Document Type for this document and create
|
||||
* a NamedNodeMap of all its entities. The entire map is
|
||||
* traversed and the names of the entities are retrieved.
|
||||
* There should be 5 entities. Duplicates should be ignored.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetentities : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetentities(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
NamedNodeMap entityList;
|
||||
String name;
|
||||
std::vector<string_type> expectedResult;
|
||||
expectedResult.push_back(SA::construct_from_utf8("ent1"));
|
||||
expectedResult.push_back(SA::construct_from_utf8("ent2"));
|
||||
expectedResult.push_back(SA::construct_from_utf8("ent3"));
|
||||
expectedResult.push_back(SA::construct_from_utf8("ent4"));
|
||||
expectedResult.push_back(SA::construct_from_utf8("ent5"));
|
||||
|
||||
std::vector<string_type> expectedResultSVG;
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("ent1"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("ent2"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("ent3"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("ent4"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("ent5"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("svgunit"));
|
||||
expectedResultSVG.push_back(SA::construct_from_utf8("svgtest"));
|
||||
|
||||
std::vector<string_type> nameList;
|
||||
|
||||
Node entity;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
entityList = docType.getEntities();
|
||||
assertNotNull(entityList);
|
||||
for (int indexN65659 = 0; indexN65659 != entityList.getLength(); indexN65659++) {
|
||||
entity = (Node) entityList.item(indexN65659);
|
||||
name = entity.getNodeName();
|
||||
nameList.push_back(name);
|
||||
}
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertEquals(expectedResultSVG, nameList);
|
||||
} else {
|
||||
assertEquals(expectedResult, nameList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentities";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,104 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetentitieslength
|
||||
#define test_documenttypegetentitieslength
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Duplicate entities are to be discarded.
|
||||
* Retrieve the Document Type for this document and create
|
||||
* a NamedNodeMap of all its entities. The entity named
|
||||
* "ent1" is defined twice and therefore that last
|
||||
* occurrance should be discarded.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetentitieslength : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetentitieslength(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
NamedNodeMap entityList;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
entityList = docType.getEntities();
|
||||
assertNotNull(entityList);
|
||||
|
||||
if (("image/svg+xml" == getContentType())) {
|
||||
assertSize(7, entityList);
|
||||
} else {
|
||||
assertSize(5, entityList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitieslength";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetentitiestype
|
||||
#define test_documenttypegetentitiestype
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Every node in the map returned by the "getEntities()"
|
||||
* method implements the Entity interface.
|
||||
*
|
||||
* Retrieve the Document Type for this document and create
|
||||
* a NamedNodeMap of all its entities. Traverse the
|
||||
* entire list and examine the NodeType of each node
|
||||
* in the list.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1788794630</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetentitiestype : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetentitiestype(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
NamedNodeMap entityList;
|
||||
Node entity;
|
||||
int entityType;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
entityList = docType.getEntities();
|
||||
assertNotNull(entityList);
|
||||
for (int indexN65609 = 0; indexN65609 != entityList.getLength(); indexN65609++) {
|
||||
entity = (Node) entityList.item(indexN65609);
|
||||
entityType = (int) entity.getNodeType();
|
||||
assertEquals(6, entityType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetentitiestype";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
113
tests/DOM/conformance/level1/core/documenttypegetnotations.hpp
Normal file
113
tests/DOM/conformance/level1/core/documenttypegetnotations.hpp
Normal file
|
@ -0,0 +1,113 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetnotations
|
||||
#define test_documenttypegetnotations
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "getNotations()" method creates a NamedNodeMap that
|
||||
* contains all the notations declared in the DTD.
|
||||
*
|
||||
* Retrieve the Document Type for this document and create
|
||||
* a NamedNodeMap object of all the notations. There
|
||||
* should be two items in the list (notation1 and notation2).
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetnotations : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetnotations(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
NamedNodeMap notationList;
|
||||
Node notation;
|
||||
String notationName;
|
||||
std::vector<string_type> actual;
|
||||
|
||||
std::vector<string_type> expected;
|
||||
expected.push_back(SA::construct_from_utf8("notation1"));
|
||||
expected.push_back(SA::construct_from_utf8("notation2"));
|
||||
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
notationList = docType.getNotations();
|
||||
assertNotNull(notationList);
|
||||
for (int indexN65627 = 0; indexN65627 != notationList.getLength(); indexN65627++) {
|
||||
notation = (Node) notationList.item(indexN65627);
|
||||
notationName = notation.getNodeName();
|
||||
actual.push_back(notationName);
|
||||
}
|
||||
assertEquals(expected, actual);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotations";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_documenttypegetnotationstype
|
||||
#define test_documenttypegetnotationstype
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Every node in the map returned by the "getNotations()"
|
||||
* method implements the Notation interface.
|
||||
*
|
||||
* Retrieve the Document Type for this document and create
|
||||
* a NamedNodeMap object of all the notations. Traverse
|
||||
* the entire list and examine the NodeType of each node.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-D46829EF</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class documenttypegetnotationstype : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
documenttypegetnotationstype(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DocumentType docType;
|
||||
NamedNodeMap notationList;
|
||||
Node notation;
|
||||
int notationType;
|
||||
doc = (Document) load("staff", false);
|
||||
docType = doc.getDoctype();
|
||||
assertNotNull(docType);
|
||||
notationList = docType.getNotations();
|
||||
assertNotNull(notationList);
|
||||
for (int indexN65609 = 0; indexN65609 != notationList.getLength(); indexN65609++) {
|
||||
notation = (Node) notationList.item(indexN65609);
|
||||
notationType = (int) notation.getNodeType();
|
||||
assertEquals(12, notationType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documenttypegetnotationstype";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_domimplementationfeaturenoversion
|
||||
#define test_domimplementationfeaturenoversion
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* hasFeature("XML", "") should return true for implementations that can read staff files.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7</a>
|
||||
* @see <a href="http://www.w3.org/2000/11/DOM-Level-2-errata#core-14">http://www.w3.org/2000/11/DOM-Level-2-errata#core-14</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class domimplementationfeaturenoversion : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
domimplementationfeaturenoversion(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DOMImplementation domImpl;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", false);
|
||||
domImpl = doc.getImplementation();
|
||||
state = domImpl.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8(""));
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenoversion";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,94 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_domimplementationfeaturenull
|
||||
#define test_domimplementationfeaturenull
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* hasFeature("XML", null) should return true for implementations that can read staff documents.
|
||||
* @author NIST
|
||||
* @author Curt Arnold
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7</a>
|
||||
* @see <a href="http://www.w3.org/2000/11/DOM-Level-2-errata#core-14">http://www.w3.org/2000/11/DOM-Level-2-errata#core-14</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class domimplementationfeaturenull : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
domimplementationfeaturenull(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DOMImplementation domImpl;
|
||||
boolean state;
|
||||
String nullVersion;
|
||||
doc = (Document) load("staff", false);
|
||||
domImpl = doc.getImplementation();
|
||||
state = domImpl.hasFeature(SA::construct_from_utf8("XML"), nullVersion);
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturenull";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,92 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_domimplementationfeaturexml
|
||||
#define test_domimplementationfeaturexml
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* hasFeature("xml", "1.0") should return true for implementations that can read staff documents.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class domimplementationfeaturexml : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
domimplementationfeaturexml(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
DOMImplementation domImpl;
|
||||
boolean state;
|
||||
doc = (Document) load("staff", false);
|
||||
domImpl = doc.getImplementation();
|
||||
state = domImpl.hasFeature(SA::construct_from_utf8("xml"), SA::construct_from_utf8("1.0"));
|
||||
assertTrue(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/domimplementationfeaturexml";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
102
tests/DOM/conformance/level1/core/elementaddnewattribute.hpp
Normal file
102
tests/DOM/conformance/level1/core/elementaddnewattribute.hpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_elementaddnewattribute
|
||||
#define test_elementaddnewattribute
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setAttribute(name,value)" method adds a new attribute
|
||||
* to the Element
|
||||
*
|
||||
* Retrieve the last child of the last employee, then
|
||||
* add an attribute to it by invoking the
|
||||
* "setAttribute(name,value)" method. It should create
|
||||
* a "name" attribute with an assigned value equal to
|
||||
* "value".
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class elementaddnewattribute : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
elementaddnewattribute(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Element testEmployee;
|
||||
String attrValue;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testEmployee = (Element) elementList.item(4);
|
||||
testEmployee.setAttribute(SA::construct_from_utf8("district"), SA::construct_from_utf8("dallas"));
|
||||
attrValue = testEmployee.getAttribute(SA::construct_from_utf8("district"));
|
||||
assertEquals("dallas", attrValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementaddnewattribute";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
105
tests/DOM/conformance/level1/core/elementassociatedattribute.hpp
Normal file
105
tests/DOM/conformance/level1/core/elementassociatedattribute.hpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_elementassociatedattribute
|
||||
#define test_elementassociatedattribute
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* Elements may have attributes associated with them.
|
||||
*
|
||||
* Retrieve the first attribute from the last child of
|
||||
* the first employee and invoke the "getSpecified()"
|
||||
* method. This test is only intended to show that
|
||||
* Elements can actually have attributes. This test uses
|
||||
* the "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class elementassociatedattribute : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
elementassociatedattribute(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Node testEmployee;
|
||||
NamedNodeMap attributes;
|
||||
Attr domesticAttr;
|
||||
boolean specified;
|
||||
doc = (Document) load("staff", false);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testEmployee = elementList.item(0);
|
||||
attributes = testEmployee.getAttributes();
|
||||
domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("domestic"));
|
||||
specified = domesticAttr.getSpecified();
|
||||
assertTrue(specified);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementassociatedattribute";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_elementchangeattributevalue
|
||||
#define test_elementchangeattributevalue
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setAttribute(name,value)" method adds a new attribute
|
||||
* to the Element. If the "name" is already present, then
|
||||
* its value should be changed to the new one that is in
|
||||
* the "value" parameter.
|
||||
*
|
||||
* Retrieve the last child of the fourth employee, then add
|
||||
* an attribute to it by invoking the
|
||||
* "setAttribute(name,value)" method. Since the name of the
|
||||
* used attribute("street") is already present in this
|
||||
* element, then its value should be changed to the new one
|
||||
* of the "value" parameter.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class elementchangeattributevalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
elementchangeattributevalue(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Element testEmployee;
|
||||
String attrValue;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testEmployee = (Element) elementList.item(3);
|
||||
testEmployee.setAttribute(SA::construct_from_utf8("street"), SA::construct_from_utf8("Neither"));
|
||||
attrValue = testEmployee.getAttribute(SA::construct_from_utf8("street"));
|
||||
assertEquals("Neither", attrValue);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementchangeattributevalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
109
tests/DOM/conformance/level1/core/elementcreatenewattribute.hpp
Normal file
109
tests/DOM/conformance/level1/core/elementcreatenewattribute.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
|
||||
/*
|
||||
This c++ source file was generated by for Arabica
|
||||
and is a derived work from the source document.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef test_elementcreatenewattribute
|
||||
#define test_elementcreatenewattribute
|
||||
|
||||
#include "dom_conf_test.hpp"
|
||||
|
||||
/**
|
||||
* The "setAttributeNode(newAttr)" method adds a new
|
||||
* attribute to the Element.
|
||||
*
|
||||
* Retrieve first address element and add
|
||||
* a new attribute node to it by invoking its
|
||||
* "setAttributeNode(newAttr)" method. This test makes use
|
||||
* of the "createAttribute(name)" method from the Document
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class elementcreatenewattribute : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
public:
|
||||
elementcreatenewattribute(std::string name) : DOMTestCase(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = getContentType();
|
||||
preload(contentType, "staff", true);
|
||||
}
|
||||
|
||||
typedef typename DOMTestCase<string_type, string_adaptor> baseT;
|
||||
using baseT::DOMImplementation;
|
||||
using baseT::Document;
|
||||
using baseT::DocumentType;
|
||||
using baseT::DocumentFragment;
|
||||
using baseT::Node;
|
||||
using baseT::Element;
|
||||
using baseT::Attr;
|
||||
using baseT::NodeList;
|
||||
using baseT::NamedNodeMap;
|
||||
using baseT::Entity;
|
||||
using baseT::EntityReference;
|
||||
using baseT::CharacterData;
|
||||
using baseT::CDATASection;
|
||||
using baseT::Text;
|
||||
using baseT::Comment;
|
||||
using baseT::ProcessingInstruction;
|
||||
using baseT::Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList elementList;
|
||||
Element testAddress;
|
||||
Attr newAttribute;
|
||||
Attr oldAttr;
|
||||
Attr districtAttr;
|
||||
String attrVal;
|
||||
doc = (Document) load("staff", true);
|
||||
elementList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testAddress = (Element) elementList.item(0);
|
||||
newAttribute = doc.createAttribute(SA::construct_from_utf8("district"));
|
||||
oldAttr = testAddress.setAttributeNode(newAttribute);
|
||||
assertNull(oldAttr);
|
||||
districtAttr = testAddress.getAttributeNode(SA::construct_from_utf8("district"));
|
||||
assertNotNull(districtAttr);
|
||||
attrVal = testAddress.getAttribute(SA::construct_from_utf8("district"));
|
||||
assertEquals("", attrVal);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementcreatenewattribute";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue