r9903 - in apps/modules/trunk/test: code/Organisation tests

[email protected] Tue, 15 Sep 2009 17:26:55 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090915152655.503AB3D0E3@mia>
Author: hannes
Date: 2009-09-15 17:26:55 +0200 (Tue, 15 Sep 2009)
New Revision: 9903

Modified:
   apps/modules/trunk/test/code/Organisation/type.properties
   apps/modules/trunk/test/tests/HopObjectCollection.js
Log:
Add test for maxsize/offset/limit collections

Details at http://dev.helma.org/trac/helma/changeset/9903

Modified: apps/modules/trunk/test/code/Organisation/type.properties
===================================================================
--- apps/modules/trunk/test/code/Organisation/type.properties	2009-09-15 15:25:08 UTC (rev 9902)
+++ apps/modules/trunk/test/code/Organisation/type.properties	2009-09-15 15:26:55 UTC (rev 9903)
@@ -11,6 +11,14 @@
 persons.accessname = person_name
 persons.order = person_name
 
+range = collection(Person)
+range.local = org_id
+range.foreign = person_org_id
+range.accessname = person_name
+range.order = person_name
+range.offset = 100
+range.maxsize = 100
+
 name = org_name
 country = org_country
 

Modified: apps/modules/trunk/test/tests/HopObjectCollection.js
===================================================================
--- apps/modules/trunk/test/tests/HopObjectCollection.js	2009-09-15 15:25:08 UTC (rev 9902)
+++ apps/modules/trunk/test/tests/HopObjectCollection.js	2009-09-15 15:26:55 UTC (rev 9903)
@@ -1,5 +1,6 @@
 tests = [
     "testSize",
+    "testMaxSize",
     "testAddRemoveSmall",
     "testAddRemoveLarge",
     "testListSmall",
@@ -21,6 +22,17 @@
     assertEqual(helma.persons.size(), small);
 }
 
+function testMaxSize() {
+    assertEqual(ikea.range.size(), 100);
+    assertEqual(helma.range.size(), 0);
+    var person = ikea.range.get("Person Ikea 0150");
+    assertNotNull(person);
+    assertEqual(person, ikea.range.get(50));
+    assertEqual(person, ikea.persons.get(150));
+    assertEqual(50, ikea.range.indexOf(person));
+    assertEqual(150, ikea.persons.indexOf(person));
+}
+
 function testAddRemoveSmall(org) {
     testAddRemove(helma, small);
 }