summaryrefslogtreecommitdiff
path: root/test/testutils/foreach.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-09-19 14:06:09 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-09-19 14:06:09 +0100
commit8f4fd70667b34dc499e3ac8543a6cb3852eae2fc (patch)
treed43a13ad6c765c00ff32759d5995d460afad54d2 /test/testutils/foreach.c
parent7dbf02c5cef37edeefd89bc23de49c22ce3e2e7f (diff)
parentdb03d00ad34c4b888e5cf3034411388900f4858e (diff)
downloadlibdom-8f4fd70667b34dc499e3ac8543a6cb3852eae2fc.tar.gz
libdom-8f4fd70667b34dc499e3ac8543a6cb3852eae2fc.tar.bz2
Merge branch 'tlsa/selectstuff'
Conflicts: include/dom/html/html_select_element.h src/html/html_select_element.c src/html/html_select_element.h
Diffstat (limited to 'test/testutils/foreach.c')
-rw-r--r--test/testutils/foreach.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/testutils/foreach.c b/test/testutils/foreach.c
index e068201..05d7f2a 100644
--- a/test/testutils/foreach.c
+++ b/test/testutils/foreach.c
@@ -34,6 +34,11 @@ void foreach_initialise_domnamednodemap(dom_namednodemap *map, unsigned int *ite
*iterator = 0;
}
+void foreach_initialise_domhtmlcollection(dom_html_collection *coll, unsigned int *iterator)
+{
+ (void)coll;
+ *iterator = 0;
+}
bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node **ret)
{
@@ -97,3 +102,24 @@ bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, do
return true;
}
+
+bool _get_next_domhtmlcollection(dom_html_collection *coll, unsigned int *iterator, dom_node **ret)
+{
+ dom_exception err;
+ uint32_t len;
+
+ err = dom_html_collection_get_length(coll, &len);
+ if (err != DOM_NO_ERR)
+ return false;
+
+ if (*iterator >= len)
+ return false;
+
+ err = dom_html_collection_item(coll, (*iterator), ret);
+ if (err != DOM_NO_ERR)
+ return false;
+
+ (*iterator)++;
+
+ return true;
+}