1 /* 2 * Copyright 2012 AndroidPlot.com 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.androidplot.xy; 18 19 import org.junit.After; 20 import org.junit.Before; 21 import org.junit.Test; 22 23 import static org.junit.Assert.assertFalse; 24 import static org.junit.Assert.assertTrue; 25 26 public class RectRegionTest { 27 @Before 28 public void setUp() throws Exception { 29 30 } 31 32 @After 33 public void tearDown() throws Exception { 34 35 } 36 37 @Test 38 public void testContainsPoint() throws Exception { 39 40 } 41 42 @Test 43 public void testContainsValue() throws Exception { 44 45 } 46 47 @Test 48 public void testContainsDomainValue() throws Exception { 49 50 } 51 52 @Test 53 public void testContainsRangeValue() throws Exception { 54 55 } 56 57 58 59 @Test 60 public void testIsWithin() throws Exception { 61 62 RectRegion region1 = new RectRegion(0, 100, 0, 100, ""); 63 64 RectRegion region2 = new RectRegion(5, 10, 5, 10, ""); 65 66 assertTrue(region1.intersects(region2)); 67 assertTrue(region2.intersects(region1)); 68 69 RectRegion region3 = new RectRegion(101, 200, 101, 200, ""); 70 assertFalse(region1.intersects(region3)); 71 assertFalse(region3.intersects(region1)); 72 73 RectRegion region4 = new RectRegion(99, 109, 99, 109, ""); 74 assertTrue(region1.intersects(region4)); 75 assertTrue(region4.intersects(region1)); 76 77 // negative numbers: 78 RectRegion region5 = new RectRegion(-100, 1, -100, 1, ""); 79 assertTrue(region1.intersects(region5)); 80 assertTrue(region5.intersects(region1)); 81 } 82 } 83