diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-11-22 15:40:34 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-11-22 15:40:34 +0200 |
commit | d54b02e31dad3e0b0a60e02750efb6bc268e3974 (patch) | |
tree | 09b3710c8d6d2296808807e25c2abf87d4b0e830 /client/tests/src/com | |
parent | 4caa2f5b6e26ade52a4fba66a0a020b79f9008ea (diff) | |
download | vaadin-framework-d54b02e31dad3e0b0a60e02750efb6bc268e3974.tar.gz vaadin-framework-d54b02e31dad3e0b0a60e02750efb6bc268e3974.zip |
Introduce initial data source support for Grid (#12878)
Change-Id: I2d1b2e4a797b2dac9ee97c832fcd40fb472edc08
Diffstat (limited to 'client/tests/src/com')
-rw-r--r-- | client/tests/src/com/vaadin/client/ui/grid/RangeTest.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java b/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java index a4715924b4..4441ee901d 100644 --- a/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java +++ b/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java @@ -209,4 +209,80 @@ public class RangeTest { assertTrue("no overlap allowed", !Range.between(0, 10).endsAfter(Range.between(5, 10))); } + + @Test(expected = IllegalArgumentException.class) + public void combine_notOverlappingFirstSmaller() { + Range.between(0, 10).combineWith(Range.between(11, 20)); + } + + @Test(expected = IllegalArgumentException.class) + public void combine_notOverlappingSecondLarger() { + Range.between(11, 20).combineWith(Range.between(0, 10)); + } + + @Test(expected = IllegalArgumentException.class) + public void combine_firstEmptyNotOverlapping() { + Range.between(15, 15).combineWith(Range.between(0, 10)); + } + + @Test(expected = IllegalArgumentException.class) + public void combine_secondEmptyNotOverlapping() { + Range.between(0, 10).combineWith(Range.between(15, 15)); + } + + @Test + public void combine_barelyOverlapping() { + Range r1 = Range.between(0, 10); + Range r2 = Range.between(10, 20); + + // Test both ways, should give the same result + Range combined1 = r1.combineWith(r2); + Range combined2 = r2.combineWith(r1); + assertEquals(combined1, combined2); + + assertEquals(0, combined1.getStart()); + assertEquals(20, combined1.getEnd()); + } + + @Test + public void combine_subRange() { + Range r1 = Range.between(0, 10); + Range r2 = Range.between(2, 8); + + // Test both ways, should give the same result + Range combined1 = r1.combineWith(r2); + Range combined2 = r2.combineWith(r1); + assertEquals(combined1, combined2); + + assertEquals(r1, combined1); + } + + @Test + public void combine_intersecting() { + Range r1 = Range.between(0, 10); + Range r2 = Range.between(5, 15); + + // Test both ways, should give the same result + Range combined1 = r1.combineWith(r2); + Range combined2 = r2.combineWith(r1); + assertEquals(combined1, combined2); + + assertEquals(0, combined1.getStart()); + assertEquals(15, combined1.getEnd()); + + } + + @Test + public void combine_emptyInside() { + Range r1 = Range.between(0, 10); + Range r2 = Range.between(5, 5); + + // Test both ways, should give the same result + Range combined1 = r1.combineWith(r2); + Range combined2 = r2.combineWith(r1); + assertEquals(combined1, combined2); + + assertEquals(r1, combined1); + } + } |