summaryrefslogtreecommitdiffstats
path: root/client/tests
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-11-22 15:28:09 +0200
committerVaadin Code Review <review@vaadin.com>2013-11-22 13:45:59 +0000
commit69e0aac03c38f6cef4ef68f86b9450b5935c99a6 (patch)
tree802139228fa1f654fce197a6e6cda3abdb146903 /client/tests
parentd54b02e31dad3e0b0a60e02750efb6bc268e3974 (diff)
downloadvaadin-framework-69e0aac03c38f6cef4ef68f86b9450b5935c99a6.tar.gz
vaadin-framework-69e0aac03c38f6cef4ef68f86b9450b5935c99a6.zip
Unify empty ranges to always have a defined position (#12645)
Change-Id: Iaeef125159df878d3b49b1a588c19b5d1b479b76
Diffstat (limited to 'client/tests')
-rw-r--r--client/tests/src/com/vaadin/client/ui/grid/RangeTest.java38
1 files changed, 34 insertions, 4 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 4441ee901d..d73b0fb02f 100644
--- a/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java
+++ b/client/tests/src/com/vaadin/client/ui/grid/RangeTest.java
@@ -113,6 +113,24 @@ public class RangeTest {
}
@Test
+ public void split_valueBefore() {
+ Range range = Range.between(10, 20);
+ Range[] splitRanges = range.splitAt(5);
+
+ assertEquals(Range.between(10, 10), splitRanges[0]);
+ assertEquals(range, splitRanges[1]);
+ }
+
+ @Test
+ public void split_valueAfter() {
+ Range range = Range.between(10, 20);
+ Range[] splitRanges = range.splitAt(25);
+
+ assertEquals(range, splitRanges[0]);
+ assertEquals(Range.between(20, 20), splitRanges[1]);
+ }
+
+ @Test
public void emptySplitTest() {
final Range range = Range.between(5, 10);
final Range[] split1 = range.splitAt(0);
@@ -137,10 +155,22 @@ public class RangeTest {
.intersects(Range.between(5, 15)));
assertTrue("[0..10[ does not intersect [10..20[", !Range.between(0, 10)
.intersects(Range.between(10, 20)));
- assertTrue("empty range does not intersect with [0..10[", !Range
- .between(5, 5).intersects(Range.between(0, 10)));
- assertTrue("[0..10[ does not intersect with empty range", !Range
- .between(0, 10).intersects(Range.between(5, 5)));
+ }
+
+ @Test
+ public void intersects_emptyInside() {
+ assertTrue("[5..5[ does intersect with [0..10[", Range.between(5, 5)
+ .intersects(Range.between(0, 10)));
+ assertTrue("[0..10[ does intersect with [5..5[", Range.between(0, 10)
+ .intersects(Range.between(5, 5)));
+ }
+
+ @Test
+ public void intersects_emptyOutside() {
+ assertTrue("[15..15[ does not intersect with [0..10[",
+ !Range.between(15, 15).intersects(Range.between(0, 10)));
+ assertTrue("[0..10[ does not intersect with [15..15[",
+ !Range.between(0, 10).intersects(Range.between(15, 15)));
}
@Test