From 4a4a68d432a41038397d44faaebf23c05f7d544a Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 7 Jul 2012 15:13:39 +0100 Subject: DOMTS: Add proper support for assertURIEquals --- test/DOMTSHandler.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/DOMTSHandler.pm') diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm index e440f64..dd5a7a8 100644 --- a/test/DOMTSHandler.pm +++ b/test/DOMTSHandler.pm @@ -1116,7 +1116,7 @@ sub generate_assertion { case "assertURIEquals" { my $actual = $ats->{actual}; - my ($scheme, $path, $host, $file, $query, $fragment, $isAbsolute) = qw(NULL NULL NULL NULL NULL NULL NULL); + my ($scheme, $path, $host, $file, $name, $query, $fragment, $isAbsolute) = qw(NULL NULL NULL NULL NULL NULL NULL NULL); if (exists $ats->{scheme}) { $scheme = $ats->{scheme}; } @@ -1129,6 +1129,9 @@ sub generate_assertion { if (exists $ats->{file}) { $file = $ats->{file}; } + if (exists $ats->{name}) { + $name = $ats->{name}; + } if (exists $ats->{query}) { $query = $ats->{query}; } @@ -1139,7 +1142,7 @@ sub generate_assertion { $isAbsolute = $ats->{isAbsolute}; } - print "is_uri_equals($scheme, $path, $host, $file, $query, $fragment, $isAbsolute, $actual)" + print "is_uri_equals($scheme, $path, $host, $file, $name, $query, $fragment, $isAbsolute, $actual)" } } -- cgit v1.2.3 From 73cbed2db0bb587f2c544cdf92dbf56eb7a79971 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 7 Jul 2012 15:31:40 +0100 Subject: HTMLTitleElement: Implementation and enabling of test --- Makefile | 1 + include/dom/dom.h | 1 + src/html/TODO | 2 +- src/html/html_document.c | 16 ++++----- src/html/html_title_element.c | 20 ++++------- src/html/html_title_element.h | 2 ++ test/DOMTSHandler.pm | 13 +++++-- .../tests/level1/html/HTMLTitleElement01.xml | 42 ++++++++++++++++++++++ .../tests/level1/html/HTMLTitleElement01.xml.kfail | 42 ---------------------- 9 files changed, 71 insertions(+), 68 deletions(-) create mode 100644 test/testcases/tests/level1/html/HTMLTitleElement01.xml delete mode 100644 test/testcases/tests/level1/html/HTMLTitleElement01.xml.kfail (limited to 'test/DOMTSHandler.pm') diff --git a/Makefile b/Makefile index eab868d..96e2d4e 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_document.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_html_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_head_element.h +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_title_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_form_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in diff --git a/include/dom/dom.h b/include/dom/dom.h index 77a40b3..20cd164 100644 --- a/include/dom/dom.h +++ b/include/dom/dom.h @@ -42,6 +42,7 @@ #include #include #include +#include #include /* DOM Events header */ diff --git a/src/html/TODO b/src/html/TODO index 491e916..fa5f8f0 100644 --- a/src/html/TODO +++ b/src/html/TODO @@ -4,7 +4,7 @@ HTMLElement html_element UNFINISHED HTMLHtmlElement html_html_element DONE HTMLHeadElement html_head_element DONE HTMLLinkElement html_link_element MISSING -HTMLTitleElement html_title_element MISSING +HTMLTitleElement html_title_element DONE HTMLMetaElement html_meta_element MISSING HTMLBaseElement html_base_element MISSING HTMLIsIndexElement html_isindex_element MISSING diff --git a/src/html/html_document.c b/src/html/html_document.c index 6978e06..11ee899 100644 --- a/src/html/html_document.c +++ b/src/html/html_document.c @@ -13,6 +13,7 @@ #include "html/html_collection.h" #include "html/html_html_element.h" #include "html/html_head_element.h" +#include "html/html_title_element.h" #include "core/string.h" #include "utils/namespace.h" @@ -170,6 +171,11 @@ _dom_html_document_create_element_internal(dom_html_document *html, (dom_html_head_element **) result); } + if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TITLE])) { + return _dom_html_title_element_create(html, namespace, prefix, + (dom_html_title_element **) result); + } + return _dom_html_element_create(html, tag_name, namespace, prefix, result); } @@ -293,20 +299,12 @@ dom_exception _dom_html_document_get_title(dom_html_document *doc, *title = dom_string_ref(doc->title); } else { dom_element *node; - dom_string *title_str; dom_nodelist *nodes; unsigned long len; - exc = dom_string_create_interned((uint8_t*)"title", - 5, &title_str); - if (exc != DOM_NO_ERR) { - return exc; - } - exc = dom_document_get_elements_by_tag_name(doc, - title_str, + doc->memoised[hds_TITLE], &nodes); - dom_string_unref(title_str); if (exc != DOM_NO_ERR) { return exc; } diff --git a/src/html/html_title_element.c b/src/html/html_title_element.c index ea4d24c..73870a6 100644 --- a/src/html/html_title_element.c +++ b/src/html/html_title_element.c @@ -11,6 +11,7 @@ #include #include +#include "html/html_document.h" #include "html/html_title_element.h" #include "core/node.h" @@ -31,6 +32,7 @@ static struct dom_element_protected_vtable _protect_vtable = { * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_title_element **ele) { struct dom_node_internal *node; @@ -44,7 +46,7 @@ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, node->base.vtable = &_dom_element_vtable; node->vtable = &_protect_vtable; - return _dom_html_title_element_initialise(doc, *ele); + return _dom_html_title_element_initialise(doc, namespace, prefix, *ele); } /** @@ -55,20 +57,12 @@ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_title_element_initialise(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_title_element *ele) { - dom_string *name = NULL; - dom_exception err; - - err = dom_string_create((const uint8_t *) "TITLE", SLEN("TITLE"), - &name); - if (err != DOM_NO_ERR) - return err; - - err = _dom_html_element_initialise(doc, &ele->base, name, NULL, NULL); - dom_string_unref(name); - - return err; + return _dom_html_element_initialise(doc, &ele->base, + doc->memoised[hds_TITLE], + namespace, prefix); } /** diff --git a/src/html/html_title_element.h b/src/html/html_title_element.h index 958c3fe..51adaf9 100644 --- a/src/html/html_title_element.h +++ b/src/html/html_title_element.h @@ -19,10 +19,12 @@ struct dom_html_title_element { /* Create a dom_html_title_element object */ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_title_element **ele); /* Initialise a dom_html_title_element object */ dom_exception _dom_html_title_element_initialise(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_title_element *ele); /* Finalise a dom_html_title_element object */ diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm index dd5a7a8..37f6166 100644 --- a/test/DOMTSHandler.pm +++ b/test/DOMTSHandler.pm @@ -788,7 +788,7 @@ sub generate_attribute_fetcher { } my $fetcher = to_attribute_fetcher($ats{'interface'}, "$en"); - + my $cast = to_attribute_cast($ats{'interface'}); my $unref = 0; my $temp_node = 0; # Deal with the situation like @@ -807,14 +807,14 @@ sub generate_attribute_fetcher { my $t = type_to_ctype($self->{'var'}->{$ats{'var'}}); $tnode_index ++; print "\t$t tnode$tnode_index = NULL;\n"; - print "\texp = $fetcher($ats{'obj'}, \&tnode$tnode_index);\n"; + print "\texp = $fetcher(${cast}$ats{'obj'}, \&tnode$tnode_index);\n"; # The ats{'obj'} must have been added to cleanup stack $unref = 1; # Indicate that we have created a temp node $temp_node = 1; } else { $unref = $self->param_unref($ats{'var'}); - print "\texp = $fetcher($ats{'obj'}, \&$ats{'var'});\n"; + print "\texp = $fetcher(${cast}$ats{'obj'}, \&$ats{'var'});\n"; } @@ -1379,6 +1379,13 @@ sub to_attribute_accessor { return $ret; } +sub to_attribute_cast { + my $type = shift; + my $ret = get_prefix($type); + $ret =~ s/h_t_m_l/html/; + return "(${ret} *)"; +} + sub get_prefix { my $type = shift; diff --git a/test/testcases/tests/level1/html/HTMLTitleElement01.xml b/test/testcases/tests/level1/html/HTMLTitleElement01.xml new file mode 100644 index 0000000..9b95d95 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLTitleElement01.xml @@ -0,0 +1,42 @@ + + + + + + + +HTMLTitleElement01 +NIST + + The text attribute is the specified title as a string. + + Retrieve the text attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLTitleElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLTitleElement01.xml.kfail deleted file mode 100644 index 9b95d95..0000000 --- a/test/testcases/tests/level1/html/HTMLTitleElement01.xml.kfail +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -HTMLTitleElement01 -NIST - - The text attribute is the specified title as a string. - - Retrieve the text attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - -- cgit v1.2.3 From 85ad24b2f105681e9e4dcb0e138668bda706b628 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 7 Jul 2012 17:11:34 +0100 Subject: DOMTSHandler: Enable support for HTMLCollection and enable another form test --- test/DOMTSHandler.pm | 4 ++ .../tests/level1/html/HTMLFormElement01.xml | 45 ++++++++++++++++++++++ .../tests/level1/html/HTMLFormElement01.xml.kfail | 45 ---------------------- 3 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 test/testcases/tests/level1/html/HTMLFormElement01.xml delete mode 100644 test/testcases/tests/level1/html/HTMLFormElement01.xml.kfail (limited to 'test/DOMTSHandler.pm') diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm index 37f6166..6545332 100644 --- a/test/DOMTSHandler.pm +++ b/test/DOMTSHandler.pm @@ -38,6 +38,7 @@ our %special_type = ( DOMImplementation => "dom_implementation *", NamedNodeMap => "dom_namednodemap *", NodeList => "dom_nodelist *", + HTMLCollection => "dom_html_collection *", CharacterData => "dom_characterdata *", CDATASection => "dom_cdata_section *", ); @@ -46,6 +47,7 @@ our %special_prefix = ( DOMImplementation => "dom_implementation", NamedNodeMap => "dom_namednodemap", NodeList => "dom_nodelist", + HTMLCollection => "dom_html_collection", CharacterData => "dom_characterdata", CDATASection => "dom_cdata_section *", ); @@ -54,6 +56,7 @@ our %unref_prefix = ( DOMString => "dom_string", NamedNodeMap => "dom_namednodemap", NodeList => "dom_nodelist", + HTMLCollection => "dom_html_collection", ); our %special_method = ( @@ -79,6 +82,7 @@ our %override_suffix = ( DOMImplementation => "domimplementation", NamedNodeMap => "domnamednodemap", NodeList => "domnodelist", + HTMLCollection => "domhtmlcollection", Collection => "list", List => "list", ); diff --git a/test/testcases/tests/level1/html/HTMLFormElement01.xml b/test/testcases/tests/level1/html/HTMLFormElement01.xml new file mode 100644 index 0000000..057fac5 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLFormElement01.xml @@ -0,0 +1,45 @@ + + + + + + + +HTMLFormElement01 +NIST + + The elements attribute specifies a collection of all control element + in the form. + + Retrieve the elements attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLFormElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLFormElement01.xml.kfail deleted file mode 100644 index 057fac5..0000000 --- a/test/testcases/tests/level1/html/HTMLFormElement01.xml.kfail +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - -HTMLFormElement01 -NIST - - The elements attribute specifies a collection of all control element - in the form. - - Retrieve the elements attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - - - -- cgit v1.2.3 From 3cca6f95867759cd3610aef0157daa09b506b17d Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 7 Jul 2012 17:30:25 +0100 Subject: DOMTSHandler.pm: Add casts for method calls, enable two more tests --- test/DOMTSHandler.pm | 4 +-- .../tests/level1/html/HTMLFormElement09.xml | 37 ++++++++++++++++++++++ .../tests/level1/html/HTMLFormElement09.xml.kfail | 37 ---------------------- .../tests/level1/html/HTMLFormElement10.xml | 37 ++++++++++++++++++++++ .../tests/level1/html/HTMLFormElement10.xml.kfail | 37 ---------------------- 5 files changed, 76 insertions(+), 76 deletions(-) create mode 100644 test/testcases/tests/level1/html/HTMLFormElement09.xml delete mode 100644 test/testcases/tests/level1/html/HTMLFormElement09.xml.kfail create mode 100644 test/testcases/tests/level1/html/HTMLFormElement10.xml delete mode 100644 test/testcases/tests/level1/html/HTMLFormElement10.xml.kfail (limited to 'test/DOMTSHandler.pm') diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm index 6545332..65efff3 100644 --- a/test/DOMTSHandler.pm +++ b/test/DOMTSHandler.pm @@ -665,9 +665,9 @@ sub generate_method { } $method = to_cmethod($ats{'interface'}, $en); - + my $cast = to_attribute_cast($ats{'interface'}); my $ns = $dd->find("parameters/param", $node); - my $params = "$ats{'obj'}"; + my $params = "${cast}$ats{'obj'}"; for ($count = 1; $count <= $ns->size; $count++) { my $n = $ns->get_node($count); my $p = $n->getAttribute("name"); diff --git a/test/testcases/tests/level1/html/HTMLFormElement09.xml b/test/testcases/tests/level1/html/HTMLFormElement09.xml new file mode 100644 index 0000000..4f552d6 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLFormElement09.xml @@ -0,0 +1,37 @@ + + + + + + + +HTMLFormElement09 +Curt Arnold + +HTMLFormElement.reset restores the forms default values. + +2004-03-18 + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLFormElement09.xml.kfail b/test/testcases/tests/level1/html/HTMLFormElement09.xml.kfail deleted file mode 100644 index 4f552d6..0000000 --- a/test/testcases/tests/level1/html/HTMLFormElement09.xml.kfail +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -HTMLFormElement09 -Curt Arnold - -HTMLFormElement.reset restores the forms default values. - -2004-03-18 - - - - - - - - - - - diff --git a/test/testcases/tests/level1/html/HTMLFormElement10.xml b/test/testcases/tests/level1/html/HTMLFormElement10.xml new file mode 100644 index 0000000..8d1f3b4 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLFormElement10.xml @@ -0,0 +1,37 @@ + + + + + + + +HTMLFormElement10 +Curt Arnold + +HTMLFormElement.submit submits the form. + +2004-03-18 + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLFormElement10.xml.kfail b/test/testcases/tests/level1/html/HTMLFormElement10.xml.kfail deleted file mode 100644 index 8d1f3b4..0000000 --- a/test/testcases/tests/level1/html/HTMLFormElement10.xml.kfail +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - -HTMLFormElement10 -Curt Arnold - -HTMLFormElement.submit submits the form. - -2004-03-18 - - - - - - - - - - - -- cgit v1.2.3