aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics.java75
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java79
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/TestFontDetails.java45
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java44
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java50
5 files changed, 0 insertions, 293 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics.java b/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
deleted file mode 100644
index 71e02add67..0000000000
--- a/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.poi.hssf.usermodel;
-
-import junit.framework.TestCase;
-
-import java.awt.*;
-
-/**
- * Tests the capabilities of the EscherGraphics class.
- *
- * @author Glen Stampoultzis (glens at apache.org)
- */
-public class TestEscherGraphics extends TestCase
-{
- private HSSFShapeGroup escherGroup;
- private EscherGraphics graphics;
-
- protected void setUp() throws Exception
- {
- HSSFWorkbook workbook = new HSSFWorkbook();
- HSSFSheet sheet = workbook.createSheet("test");
- escherGroup = sheet.createDrawingPatriarch().createGroup(new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short) 0,0));
- escherGroup = new HSSFShapeGroup(null, new HSSFChildAnchor());
- graphics = new EscherGraphics(this.escherGroup, workbook, Color.black, 1.0f);
- super.setUp();
- }
-
- public void testGetFont() throws Exception
- {
- Font f = graphics.getFont();
- if (f.toString().indexOf("dialog") == -1)
- assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", f.toString());
- }
-
- public void testGetFontMetrics() throws Exception
- {
- Font f = graphics.getFont();
- if (f.toString().indexOf("dialog") != -1)
- return;
- FontMetrics fontMetrics = graphics.getFontMetrics(graphics.getFont());
- assertEquals(7, fontMetrics.charWidth('X'));
- assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", fontMetrics.getFont().toString());
- }
-
- public void testSetFont() throws Exception
- {
- Font f = new Font("Helvetica", 0, 12);
- graphics.setFont(f);
- assertEquals(f, graphics.getFont());
- }
-
- public void testSetColor() throws Exception
- {
- graphics.setColor(Color.red);
- assertEquals(Color.red, graphics.getColor());
- }
-
- public void testFillRect() throws Exception
- {
- graphics.fillRect( 10, 10, 20, 20 );
- HSSFSimpleShape s = (HSSFSimpleShape) escherGroup.getChildren().get(0);
- assertEquals(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE, s.getShapeType());
- assertEquals(10, s.getAnchor().getDx1());
- assertEquals(10, s.getAnchor().getDy1());
- assertEquals(30, s.getAnchor().getDy2());
- assertEquals(30, s.getAnchor().getDx2());
- }
-
- public void testDrawString() throws Exception
- {
- graphics.drawString("This is a test", 10, 10);
- HSSFTextbox t = (HSSFTextbox) escherGroup.getChildren().get(0);
- assertEquals("This is a test", t.getString().toString());
- }
-
-}
diff --git a/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java b/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
deleted file mode 100644
index 3f77c8b955..0000000000
--- a/src/java/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.apache.poi.hssf.usermodel;
-
-import junit.framework.TestCase;
-
-import java.awt.*;
-import java.io.FileOutputStream;
-
-/**
- * Tests the Graphics2d drawing capability.
- *
- * @author Glen Stampoultzis (glens at apache.org)
- */
-public class TestEscherGraphics2d extends TestCase
-{
- private HSSFShapeGroup escherGroup;
- private EscherGraphics2d graphics;
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- HSSFWorkbook workbook = new HSSFWorkbook();
- HSSFSheet sheet = workbook.createSheet("test");
- escherGroup = sheet.createDrawingPatriarch().createGroup(new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short) 0,0));
- escherGroup = new HSSFShapeGroup(null, new HSSFChildAnchor());
- EscherGraphics g = new EscherGraphics(this.escherGroup, workbook, Color.black, 1.0f);
- graphics = new EscherGraphics2d(g);
-
- }
-
- public void testDrawString() throws Exception
- {
- graphics.drawString("This is a test", 10, 10);
- HSSFTextbox t = (HSSFTextbox) escherGroup.getChildren().get(0);
- assertEquals("This is a test", t.getString().toString());
- }
-
- public void testFillRect() throws Exception
- {
- graphics.fillRect( 10, 10, 20, 20 );
- HSSFSimpleShape s = (HSSFSimpleShape) escherGroup.getChildren().get(0);
- assertEquals(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE, s.getShapeType());
- assertEquals(10, s.getAnchor().getDx1());
- assertEquals(10, s.getAnchor().getDy1());
- assertEquals(30, s.getAnchor().getDy2());
- assertEquals(30, s.getAnchor().getDx2());
- }
-
- public void testGetFontMetrics() throws Exception
- {
- FontMetrics fontMetrics = graphics.getFontMetrics(graphics.getFont());
- if (graphics.getFont().toString().indexOf("dialog") != -1) // if dialog is returned we can't run the test properly.
- return;
- assertEquals(7, fontMetrics.charWidth('X'));
- assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", fontMetrics.getFont().toString());
- }
-
- public void testSetFont() throws Exception
- {
- Font f = new Font("Helvetica", 0, 12);
- graphics.setFont(f);
- assertEquals(f, graphics.getFont());
- }
-
- public void testSetColor() throws Exception
- {
- graphics.setColor(Color.red);
- assertEquals(Color.red, graphics.getColor());
- }
-
- public void testGetFont() throws Exception
- {
- Font f = graphics.getFont();
- if (graphics.getFont().toString().indexOf("dialog") != -1) // if dialog is returned we can't run the test properly.
- return;
-
- assertEquals("java.awt.Font[family=Arial,name=Arial,style=plain,size=10]", f.toString());
- }
-}
diff --git a/src/java/org/apache/poi/hssf/usermodel/TestFontDetails.java b/src/java/org/apache/poi/hssf/usermodel/TestFontDetails.java
deleted file mode 100644
index 532e62568b..0000000000
--- a/src/java/org/apache/poi/hssf/usermodel/TestFontDetails.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.poi.hssf.usermodel;
-
-import junit.framework.TestCase;
-
-import java.util.Properties;
-
-/**
- * Tests the implementation of the FontDetails class.
- *
- * @author Glen Stampoultzis (glens at apache.org)
- */
-public class TestFontDetails extends TestCase
-{
- private Properties properties;
- private FontDetails fontDetails;
-
- protected void setUp() throws Exception
- {
- properties = new Properties();
- properties.setProperty("font.Arial.height", "13");
- properties.setProperty("font.Arial.characters", "a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ");
- properties.setProperty("font.Arial.widths", "6, 6, 6, 6, 6, 3, 6, 6, 3, 4, 6, 3, 9, 6, 6, 6, 6, 4, 6, 3, 6, 7, 9, 6, 5, 5, 7, 7, 7, 7, 7, 6, 8, 7, 3, 6, 7, 6, 9, 7, 8, 7, 8, 7, 7, 5, 7, 7, 9, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, ");
- fontDetails = FontDetails.create("Arial", properties);
-
- }
-
- public void testCreate() throws Exception
- {
- assertEquals(13, fontDetails.getHeight());
- assertEquals(6, fontDetails.getCharWidth('a'));
- assertEquals(3, fontDetails.getCharWidth('f'));
- }
-
- public void testGetStringWidth() throws Exception
- {
- assertEquals(9, fontDetails.getStringWidth("af"));
- }
-
- public void testGetCharWidth() throws Exception
- {
- assertEquals(6, fontDetails.getCharWidth('a'));
- assertEquals(9, fontDetails.getCharWidth('='));
- }
-
-}
diff --git a/src/java/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java b/src/java/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java
deleted file mode 100644
index ab3e06a3d6..0000000000
--- a/src/java/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.poi.hssf.usermodel;
-
-import junit.framework.TestCase;
-
-/**
- * Various tests for HSSFClientAnchor.
- *
- * @author Glen Stampoultzis (glens at apache.org)
- */
-public class TestHSSFClientAnchor extends TestCase
-{
- public void testGetAnchorHeightInPoints() throws Exception
- {
- HSSFWorkbook wb = new HSSFWorkbook();
- HSSFSheet sheet = wb.createSheet("test");
- HSSFClientAnchor a = new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short)0,0);
- float p = a.getAnchorHeightInPoints(sheet);
- assertEquals(11.953,p,0.001);
-
- sheet.createRow(0).setHeightInPoints(14);
- a = new HSSFClientAnchor(0,0,1023,255,(short)0,0,(short)0,0);
- p = a.getAnchorHeightInPoints(sheet);
- assertEquals(13.945,p,0.001);
-
- a = new HSSFClientAnchor(0,0,1023,127,(short)0,0,(short)0,0);
- p = a.getAnchorHeightInPoints(sheet);
- assertEquals(6.945,p,0.001);
-
- a = new HSSFClientAnchor(0,126,1023,127,(short)0,0,(short)0,0);
- p = a.getAnchorHeightInPoints(sheet);
- assertEquals(0.054,p,0.001);
-
- a = new HSSFClientAnchor(0,0,1023,0,(short)0,0,(short)0,1);
- p = a.getAnchorHeightInPoints(sheet);
- assertEquals(14.0,p,0.001);
-
- sheet.createRow(0).setHeightInPoints(12);
- a = new HSSFClientAnchor(0,127,1023,127,(short)0,0,(short)0,1);
- p = a.getAnchorHeightInPoints(sheet);
- assertEquals(12.0,p,0.001);
-
- }
-
-}
diff --git a/src/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java b/src/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
deleted file mode 100644
index 69dcb78e7e..0000000000
--- a/src/java/org/apache/poi/hssf/usermodel/TestHSSFRichTextString.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.poi.hssf.usermodel;
-
-import junit.framework.TestCase;
-
-public class TestHSSFRichTextString extends TestCase
-{
- public void testApplyFont() throws Exception
- {
-
- HSSFRichTextString r = new HSSFRichTextString("testing");
- assertEquals(1,r.numFormattingRuns());
- r.applyFont(2,4, new HSSFFont((short)1, null));
- assertEquals(3,r.numFormattingRuns());
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(0));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(1));
- assertEquals(1, r.getFontAtIndex(2));
- assertEquals(1, r.getFontAtIndex(3));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(4));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(5));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(6));
-
- r.applyFont(6,7, new HSSFFont((short)2, null));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(0));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(1));
- assertEquals(1, r.getFontAtIndex(2));
- assertEquals(1, r.getFontAtIndex(3));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(4));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(5));
- assertEquals(2, r.getFontAtIndex(6));
-
- r.applyFont(HSSFRichTextString.NO_FONT);
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(0));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(1));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(2));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(3));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(4));
- assertEquals(HSSFRichTextString.NO_FONT, r.getFontAtIndex(5));
-
- r.applyFont(new HSSFFont((short)1, null));
- assertEquals(1, r.getFontAtIndex(0));
- assertEquals(1, r.getFontAtIndex(1));
- assertEquals(1, r.getFontAtIndex(2));
- assertEquals(1, r.getFontAtIndex(3));
- assertEquals(1, r.getFontAtIndex(4));
- assertEquals(1, r.getFontAtIndex(5));
- assertEquals(1, r.getFontAtIndex(6));
-
- }
-
-}