From 6ec0dc62d48de4d58cc6ea2993a3450390615c3b Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Fri, 14 Aug 2009 04:40:53 +0000 Subject: 1. Find there are indeed two testcases for Events module, so I add support for them. 2. Change DOMTSHandler to deal with more exceptions and types 3. Add a new test assertion. svn path=/trunk/dom/; revision=9280 --- test/DOMTSHandler.pm | 20 +++++++++++++++++--- test/testutils/domtsasserts.c | 7 +++++++ test/testutils/domtsasserts.h | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm index 5f36d53..4e9d304 100644 --- a/test/DOMTSHandler.pm +++ b/test/DOMTSHandler.pm @@ -103,15 +103,21 @@ our %exceptions = ( DOM_INVALID_ACCESS_ERR => 15, DOM_VALIDATION_ERR => 16, DOM_TYPE_MISMATCH_ERR => 17, - DOM_NO_MEM_ERR => (1<<16) + + DOM_UNSPECIFIED_EVENT_TYPE_ERR => (1<<30)+0, + DOM_DISPATCH_REQUEST_ERR => (1<<30)+1, + + DOM_NO_MEM_ERR => (1<<31)+0, ); our @condition = qw(same equals notEquals less lessOrEquals greater greaterOrEquals isNull notNull and or xor not instanceOf isTrue isFalse hasSize contentType hasFeature implementationAttribute); -our @exception = qw(INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR NAMESPACE_ERR); +our @exception = qw(INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR NAMESPACE_ERR UNSPECIFIED_EVENT_TYPE_ERR DISPATCH_REQUEST_ERR); our @assertion = qw(assertTrue assertFalse assertNull assertNotNull assertEquals assertNotEquals assertSame assertInstanceOf assertSize assertEventCount assertURIEquals); +our @assertexception = qw(assertDOMException assertEventException assertImplementationException); + our @control = qw(if while for-each else); our @framework_statement = qw(assign increment decrement append plus subtract mult divide load implementation comment hasFeature implementationAttribute EventMonitor.setUserObj EventMonitor.getAtEvents EventMonitor.getCaptureEvents EventMonitor.getBubbleEvents EventMonitor.getAllEvents wait); @@ -220,7 +226,7 @@ sub start_element { $self->generate_assertion($en, $element->{Attributes}); } - case "assertDOMException" { + case [@assertexception] { # Indeed, nothing to do here! } @@ -1316,6 +1322,10 @@ sub type_to_ctype { # The core module comes here $type =~ s/[A-Z]/_$&/g; $type = lc $type; + + # For events module + $type =~ s/_u_i_/_ui_/g; + return "dom".$type." *"; } @@ -1335,6 +1345,10 @@ sub to_cmethod { $ret =~ s/h_t_m_l/html/; $ret =~ s/c_d_a_t_a/cdata/; $ret =~ s/_n_s$/_ns/; + # For DOMUIEvent + $ret =~ s/_u_i_/_ui_/; + # For initEvent + $ret =~ s/init_event/init/; return $ret; } diff --git a/test/testutils/domtsasserts.c b/test/testutils/domtsasserts.c index affa881..731e19d 100644 --- a/test/testutils/domtsasserts.c +++ b/test/testutils/domtsasserts.c @@ -64,6 +64,13 @@ bool is_equals_int(int excepted, int actual, bool dummy) return excepted == actual; } +bool is_equals_bool(bool excepted, bool actual, bool dummy) +{ + UNUSED(dummy); + + return excepted == actual; +} + bool is_equals_unsigned_long(unsigned long excepted, unsigned long actual, bool dummy) { UNUSED(dummy); diff --git a/test/testutils/domtsasserts.h b/test/testutils/domtsasserts.h index ee0fb72..a09603f 100644 --- a/test/testutils/domtsasserts.h +++ b/test/testutils/domtsasserts.h @@ -34,6 +34,7 @@ bool is_same_unsigned_long(unsigned long excepted, unsigned long actual); bool is_equals_int(int excepted, int actual, bool dummy); bool is_equals_unsigned_long(unsigned long excepted, unsigned long actual, bool dummy); +bool is_equals_bool(bool excepted, bool actual, bool dummy); bool is_equals_string(const char *excepted, dom_string *actual, bool ignoreCase); bool is_equals_domstring(dom_string *excepted, dom_string *actual, bool ignoreCase); -- cgit v1.2.3