]> source.dussan.org Git - poi.git/commitdiff
test copy constructor: make changes to same range: this is a better test for deepcopy
authorJaven O'Neal <onealj@apache.org>
Mon, 13 Jun 2016 00:50:52 +0000 (00:50 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 13 Jun 2016 00:50:52 +0000 (00:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ss_border_property_template@1748073 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ss/util/TestBorderPropertyTemplate.java

index d9642ed1d1fcd1cfe7277d0e378de9dda35b6c1d..8ed7428edae356955ce332f57750e5b7f4539273 100644 (file)
@@ -47,11 +47,7 @@ public final class TestBorderPropertyTemplate {
     @Test
     public void createTemplateFromExisting() throws IOException {
         CellRangeAddress a1a1 = new CellRangeAddress(0, 0, 0, 0); //A1:A1
-        CellRangeAddress b2b2 = new CellRangeAddress(1, 1, 1, 1); //B2:B2
-        CellRangeAddress c3c3 = new CellRangeAddress(2, 2, 2, 2); //C3:C3
         CellAddress a1 = new CellAddress(0, 0); //A1
-        CellAddress b2 = new CellAddress(1, 1); //B2
-        CellAddress c3 = new CellAddress(2, 2); //C3
 
         BorderPropertyTemplate pt1 = new BorderPropertyTemplate();
         pt1.drawBorders(a1a1, BorderStyle.THIN, RED, BorderExtent.TOP);
@@ -63,16 +59,18 @@ public final class TestBorderPropertyTemplate {
         assertRed(pt2.getTemplateProperty(a1, CellUtil.TOP_BORDER_COLOR));
 
         // Changes to original template should not affect copied template.
-        pt1.drawBorders(b2b2, BorderStyle.THIN, RED, BorderExtent.TOP);
-        assertEquals(0, pt2.getNumBorders(b2));
-        assertNull(pt2.getTemplateProperty(b2, CellUtil.BORDER_TOP));
-        assertNull(pt2.getTemplateProperty(b2, CellUtil.TOP_BORDER_COLOR));
+        assertEquals(1, pt2.getNumBorders(a1));
+        pt1.drawBorders(a1a1, BorderStyle.THIN, RED, BorderExtent.LEFT);
+        assertEquals(1, pt2.getNumBorders(a1));
+        assertNull(pt2.getTemplateProperty(a1, CellUtil.BORDER_LEFT));
+        assertNull(pt2.getTemplateProperty(a1, CellUtil.LEFT_BORDER_COLOR));
 
         // Changes to copied template should not affect original template
-        pt2.drawBorders(c3c3, BorderStyle.THIN, RED, BorderExtent.TOP);
-        assertEquals(0, pt1.getNumBorders(c3));
-        assertNull(pt1.getTemplateProperty(c3, CellUtil.BORDER_TOP));
-        assertNull(pt1.getTemplateProperty(c3, CellUtil.TOP_BORDER_COLOR));
+        assertEquals(2, pt1.getNumBorders(a1));
+        pt2.drawBorders(a1a1, BorderStyle.THIN, RED, BorderExtent.RIGHT);
+        assertEquals(2, pt1.getNumBorders(a1));
+        assertNull(pt1.getTemplateProperty(a1, CellUtil.BORDER_RIGHT));
+        assertNull(pt1.getTemplateProperty(a1, CellUtil.RIGHT_BORDER_COLOR));
     }
 
     @Test