From 1b58896a2efedc790812237adc59c4585a2d403f Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 15 Sep 2009 15:26:55 +0000 Subject: [PATCH] Add test for maxsize/offset/limit collections --- test/code/Organisation/type.properties | 8 ++++++++ test/tests/HopObjectCollection.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/test/code/Organisation/type.properties b/test/code/Organisation/type.properties index c290c151..b3841219 100644 --- a/test/code/Organisation/type.properties +++ b/test/code/Organisation/type.properties @@ -11,6 +11,14 @@ persons.foreign = person_org_id 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 diff --git a/test/tests/HopObjectCollection.js b/test/tests/HopObjectCollection.js index 55cf7f89..ec063757 100644 --- a/test/tests/HopObjectCollection.js +++ b/test/tests/HopObjectCollection.js @@ -1,5 +1,6 @@ tests = [ "testSize", + "testMaxSize", "testAddRemoveSmall", "testAddRemoveLarge", "testListSmall", @@ -21,6 +22,17 @@ function testSize() { 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); }