git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1595190 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_11_BETA1
@@ -16,11 +16,13 @@ | |||
==================================================================== */ | |||
package org.apache.poi.xslf.usermodel; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.xslf.XSLFTestDataSamples; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.awt.Color; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.xslf.XSLFTestDataSamples; | |||
/** | |||
* @author Yegor Kozlov | |||
@@ -157,7 +159,7 @@ public class TestXSLFSlide extends TestCase { | |||
XSLFPictureShape sh4 = (XSLFPictureShape)shapes2[1]; | |||
XSLFPictureShape srcPic = (XSLFPictureShape)src.getSlides()[4].getShapes()[1]; | |||
assertTrue(Arrays.equals(sh4.getPictureData().getData(), srcPic.getPictureData().getData())); | |||
assertArrayEquals(sh4.getPictureData().getData(), srcPic.getPictureData().getData()); | |||
} | |||
public void testMergeSlides(){ |
@@ -16,9 +16,10 @@ | |||
==================================================================== */ | |||
package org.apache.poi.xssf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.awt.Color; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import junit.framework.TestCase; | |||
@@ -223,9 +224,9 @@ public class TestXSSFDrawing extends TestCase { | |||
assertEquals(true, rPr.getB()); | |||
assertEquals(true, rPr.getI()); | |||
assertEquals(STTextUnderlineType.SNG, rPr.getU()); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new byte[]{0, (byte)128, (byte)128} , | |||
rPr.getSolidFill().getSrgbClr().getVal())); | |||
rPr.getSolidFill().getSrgbClr().getVal()); | |||
assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb)); | |||
} | |||
@@ -288,9 +289,9 @@ public class TestXSSFDrawing extends TestCase { | |||
CTTextCharacterProperties rPr = pr.getRArray(0).getRPr(); | |||
assertEquals("Arial", rPr.getLatin().getTypeface()); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new byte[]{0, (byte)128, (byte)128} , | |||
rPr.getSolidFill().getSrgbClr().getVal())); | |||
rPr.getSolidFill().getSrgbClr().getVal()); | |||
assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb)); | |||
} | |||
@@ -322,9 +323,9 @@ public class TestXSSFDrawing extends TestCase { | |||
assertEquals("Arial", runs.get(0).getFontFamily()); | |||
Color clr = runs.get(0).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 255, 255 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb)); | |||
} | |||
@@ -398,26 +399,26 @@ public class TestXSSFDrawing extends TestCase { | |||
assertEquals("Arial", runs.get(0).getFontFamily()); | |||
Color clr = runs.get(0).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 255, 255 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
// second run properties | |||
assertEquals("Rich Text", runs.get(1).getText()); | |||
assertEquals(XSSFFont.DEFAULT_FONT_NAME, runs.get(1).getFontFamily()); | |||
clr = runs.get(1).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 255, 0 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
// third run properties | |||
assertEquals(" String", runs.get(2).getText()); | |||
assertEquals("Arial", runs.get(2).getFontFamily()); | |||
clr = runs.get(2).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 255, 255 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb)); | |||
} | |||
@@ -547,19 +548,19 @@ public class TestXSSFDrawing extends TestCase { | |||
assertEquals(TextAlign.RIGHT, paras.get(2).getTextAlign()); | |||
Color clr = paras.get(0).getTextRuns().get(0).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 255, 0, 0 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
clr = paras.get(1).getTextRuns().get(0).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 255, 0 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
clr = paras.get(2).getTextRuns().get(0).getFontColor(); | |||
assertTrue(Arrays.equals( | |||
assertArrayEquals( | |||
new int[] { 0, 0, 255 } , | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() })); | |||
new int[] { clr.getRed(), clr.getGreen(), clr.getBlue() }); | |||
assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb)); | |||
} |
@@ -17,16 +17,17 @@ | |||
package org.apache.poi.xssf.usermodel; | |||
import org.apache.poi.ss.usermodel.ClientAnchor; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.util.List; | |||
import org.apache.poi.ss.usermodel.BaseTestPicture; | |||
import org.apache.poi.ss.usermodel.ClientAnchor; | |||
import org.apache.poi.xssf.XSSFITestDataProvider; | |||
import org.apache.poi.xssf.XSSFTestDataSamples; | |||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTTwoCellAnchor; | |||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.STEditAs; | |||
import java.util.List; | |||
import java.util.Arrays; | |||
/** | |||
* @author Yegor Kozlov | |||
*/ | |||
@@ -54,7 +55,7 @@ public final class TestXSSFPicture extends BaseTestPicture { | |||
int jpegIdx = wb.addPicture(jpegData, XSSFWorkbook.PICTURE_TYPE_JPEG); | |||
assertEquals(1, pictures.size()); | |||
assertEquals("jpeg", pictures.get(jpegIdx).suggestFileExtension()); | |||
assertTrue(Arrays.equals(jpegData, pictures.get(jpegIdx).getData())); | |||
assertArrayEquals(jpegData, pictures.get(jpegIdx).getData()); | |||
XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 1, 1, 10, 30); | |||
assertEquals(ClientAnchor.MOVE_AND_RESIZE, anchor.getAnchorType()); | |||
@@ -64,7 +65,7 @@ public final class TestXSSFPicture extends BaseTestPicture { | |||
XSSFPicture shape = drawing.createPicture(anchor, jpegIdx); | |||
assertTrue(anchor.equals(shape.getAnchor())); | |||
assertNotNull(shape.getPictureData()); | |||
assertTrue(Arrays.equals(jpegData, shape.getPictureData().getData())); | |||
assertArrayEquals(jpegData, shape.getPictureData().getData()); | |||
CTTwoCellAnchor ctShapeHolder = drawing.getCTDrawing().getTwoCellAnchorArray(0); | |||
// STEditAs.ABSOLUTE corresponds to ClientAnchor.DONT_MOVE_AND_RESIZE | |||
@@ -128,16 +129,16 @@ public final class TestXSSFPicture extends BaseTestPicture { | |||
sheet1 = wb.getSheetAt(0); | |||
drawing1 = sheet1.createDrawingPatriarch(); | |||
XSSFPicture shape11 = (XSSFPicture)drawing1.getShapes().get(0); | |||
assertTrue(Arrays.equals(shape1.getPictureData().getData(), shape11.getPictureData().getData())); | |||
assertArrayEquals(shape1.getPictureData().getData(), shape11.getPictureData().getData()); | |||
XSSFPicture shape22 = (XSSFPicture)drawing1.getShapes().get(1); | |||
assertTrue(Arrays.equals(shape2.getPictureData().getData(), shape22.getPictureData().getData())); | |||
assertArrayEquals(shape2.getPictureData().getData(), shape22.getPictureData().getData()); | |||
sheet2 = wb.getSheetAt(1); | |||
drawing2 = sheet2.createDrawingPatriarch(); | |||
XSSFPicture shape33 = (XSSFPicture)drawing2.getShapes().get(0); | |||
assertTrue(Arrays.equals(shape3.getPictureData().getData(), shape33.getPictureData().getData())); | |||
assertArrayEquals(shape3.getPictureData().getData(), shape33.getPictureData().getData()); | |||
XSSFPicture shape44 = (XSSFPicture)drawing2.getShapes().get(1); | |||
assertTrue(Arrays.equals(shape4.getPictureData().getData(), shape44.getPictureData().getData())); | |||
assertArrayEquals(shape4.getPictureData().getData(), shape44.getPictureData().getData()); | |||
} | |||
@@ -20,7 +20,6 @@ package org.apache.poi.xwpf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import junit.framework.TestCase; | |||
@@ -54,7 +53,7 @@ public class TestXWPFPictureData extends TestCase { | |||
assertEquals(num + 1,pictures.size()); | |||
XWPFPictureData pict = (XWPFPictureData) sampleDoc.getRelationById(relationId); | |||
assertEquals("jpeg",pict.suggestFileExtension()); | |||
assertTrue(Arrays.equals(pictureData,pict.getData())); | |||
assertArrayEquals(pictureData,pict.getData()); | |||
} | |||
public void testPictureInHeader() throws IOException | |||
@@ -103,7 +102,7 @@ public class TestXWPFPictureData extends TestCase { | |||
assertEquals(1,pictures.size()); | |||
XWPFPictureData jpgPicData = (XWPFPictureData) doc.getRelationById(relationId); | |||
assertEquals("jpeg",jpgPicData.suggestFileExtension()); | |||
assertTrue(Arrays.equals(jpegData,jpgPicData.getData())); | |||
assertArrayEquals(jpegData,jpgPicData.getData()); | |||
// Ensure it now has one | |||
assertEquals(14,doc.getPackagePart().getRelationships().size()); | |||
@@ -120,6 +119,7 @@ public class TestXWPFPictureData extends TestCase { | |||
assertNotNull("JPEG Relationship not found",jpegRel); | |||
// Check the details | |||
assertNotNull(jpegRel); | |||
assertEquals(XWPFRelation.IMAGE_JPEG.getRelation(),jpegRel.getRelationshipType()); | |||
assertEquals("/word/document.xml",jpegRel.getSource().getPartName().toString()); | |||
assertEquals("/word/media/image1.jpeg",jpegRel.getTargetURI().getPath()); |
@@ -17,12 +17,13 @@ | |||
package org.apache.poi.hslf.model; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.awt.geom.Rectangle2D; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.io.InputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
@@ -136,7 +137,7 @@ public final class TestOleEmbedding extends TestCase { | |||
poiData1.writeFilesystem(bos); | |||
byte expData[] = bos.toByteArray(); | |||
assertTrue(Arrays.equals(expData, compData)); | |||
assertArrayEquals(expData, compData); | |||
} | |||
} |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link HeadersFootersAtom} works properly | |||
@@ -65,7 +67,7 @@ public final class TestAnimationInfoAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -80,6 +82,6 @@ public final class TestAnimationInfoAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
} |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link org.apache.poi.hslf.record.ExControl} works properly | |||
@@ -93,7 +95,7 @@ public final class TestExControl extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -118,6 +120,6 @@ public final class TestExControl extends TestCase { | |||
byte[] b = baos.toByteArray(); | |||
assertEquals(data.length, b.length); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
} |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link org.apache.poi.hslf.record.HeadersFootersAtom} works properly | |||
@@ -49,7 +51,7 @@ public final class TestExMediaAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -66,7 +68,7 @@ public final class TestExMediaAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testFlags() { |
@@ -17,9 +17,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link ExOleObjAtom} works properly | |||
@@ -51,7 +53,7 @@ public final class TestExOleObjAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -67,6 +69,6 @@ public final class TestExOleObjAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
} |
@@ -18,14 +18,16 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.InputStream; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.io.InputStream; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
import org.apache.poi.poifs.filesystem.DocumentEntry; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
/** | |||
* Tests that {@link ExOleObjStg} works properly | |||
@@ -105,7 +107,7 @@ public final class TestExOleObjStg extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -123,7 +125,7 @@ public final class TestExOleObjStg extends TestCase { | |||
byte[] b = out.toByteArray(); | |||
assertEquals(data.length, b.length); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
private byte[] readAll(InputStream is) throws IOException { |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link HeadersFootersAtom} works properly | |||
@@ -70,7 +72,7 @@ public final class TestExVideoContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -82,6 +84,6 @@ public final class TestExVideoContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
} |
@@ -17,10 +17,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests <code>FontCollection</code> and <code>FontEntityAtom</code> records | |||
@@ -76,6 +77,6 @@ public final class TestFontCollection extends TestCase { | |||
ByteArrayOutputStream out = new ByteArrayOutputStream(); | |||
fonts.writeOut(out); | |||
byte[] recdata = out.toByteArray(); | |||
assertTrue(Arrays.equals(recdata, data)); | |||
assertArrayEquals(recdata, data); | |||
} | |||
} |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link HeadersFootersAtom} works properly | |||
@@ -54,7 +56,7 @@ public final class TestHeadersFootersAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testNewRecord() throws Exception { | |||
@@ -67,7 +69,7 @@ public final class TestHeadersFootersAtom extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(data, b)); | |||
assertArrayEquals(data, b); | |||
} | |||
public void testFlags() { |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hslf.record; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests that {@link HeadersFootersContainer} works properly | |||
@@ -75,7 +77,7 @@ public final class TestHeadersFootersContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(slideData, b)); | |||
assertArrayEquals(slideData, b); | |||
} | |||
public void testNewSlideHeadersFootersContainer() throws Exception { | |||
@@ -100,7 +102,7 @@ public final class TestHeadersFootersContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(slideData, b)); | |||
assertArrayEquals(slideData, b); | |||
} | |||
public void testReadNotesHeadersFootersContainer() { | |||
@@ -129,7 +131,7 @@ public final class TestHeadersFootersContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(notesData, b)); | |||
assertArrayEquals(notesData, b); | |||
} | |||
public void testNewNotesHeadersFootersContainer() throws Exception { | |||
@@ -162,7 +164,7 @@ public final class TestHeadersFootersContainer extends TestCase { | |||
record.writeOut(baos); | |||
byte[] b = baos.toByteArray(); | |||
assertTrue(Arrays.equals(notesData, b)); | |||
assertArrayEquals(notesData, b); | |||
} | |||
} |
@@ -17,13 +17,12 @@ | |||
package org.apache.poi.hslf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hslf.usermodel.SlideShow; | |||
import org.apache.poi.POIDataSamples; | |||
import org.apache.poi.hslf.usermodel.SlideShow; | |||
/** | |||
* Tests Sound-related records: SoundCollection(2020), Sound(2022) and | |||
@@ -70,6 +69,6 @@ public final class TestSound extends TestCase { | |||
assertNotNull(sound.getSoundData()); | |||
byte[] ref_data = slTests.readFile("ringin.wav"); | |||
assertTrue(Arrays.equals(ref_data, sound.getSoundData())); | |||
assertArrayEquals(ref_data, sound.getSoundData()); | |||
} | |||
} |
@@ -17,9 +17,10 @@ | |||
package org.apache.poi.hslf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.LinkedList; | |||
import junit.framework.TestCase; | |||
@@ -187,20 +188,20 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
stpb.setParentTextSize(data_b_text_len); | |||
// 54 chars, 21 + 17 + 16 | |||
LinkedList a_ch_l = stpa.getCharacterStyles(); | |||
TextPropCollection a_ch_1 = (TextPropCollection)a_ch_l.get(0); | |||
TextPropCollection a_ch_2 = (TextPropCollection)a_ch_l.get(1); | |||
TextPropCollection a_ch_3 = (TextPropCollection)a_ch_l.get(2); | |||
LinkedList<TextPropCollection> a_ch_l = stpa.getCharacterStyles(); | |||
TextPropCollection a_ch_1 = a_ch_l.get(0); | |||
TextPropCollection a_ch_2 = a_ch_l.get(1); | |||
TextPropCollection a_ch_3 = a_ch_l.get(2); | |||
assertEquals(21, a_ch_1.getCharactersCovered()); | |||
assertEquals(17, a_ch_2.getCharactersCovered()); | |||
assertEquals(16, a_ch_3.getCharactersCovered()); | |||
// 179 chars, 30 + 28 + 25 | |||
LinkedList b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3); | |||
LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = b_ch_l.get(3); | |||
assertEquals(30, b_ch_1.getCharactersCovered()); | |||
assertEquals(28, b_ch_2.getCharactersCovered()); | |||
assertEquals(25, b_ch_3.getCharactersCovered()); | |||
@@ -212,25 +213,25 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); | |||
stpb.setParentTextSize(data_b_text_len); | |||
LinkedList b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3); | |||
LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = b_ch_l.get(3); | |||
// In first set, we get a CharFlagsTextProp and a font.size | |||
assertEquals(2,b_ch_1.getTextPropList().size()); | |||
TextProp tp_1_1 = (TextProp)b_ch_1.getTextPropList().get(0); | |||
TextProp tp_1_2 = (TextProp)b_ch_1.getTextPropList().get(1); | |||
TextProp tp_1_1 = b_ch_1.getTextPropList().get(0); | |||
TextProp tp_1_2 = b_ch_1.getTextPropList().get(1); | |||
assertEquals(true, tp_1_1 instanceof CharFlagsTextProp); | |||
assertEquals("font.size", tp_1_2.getName()); | |||
assertEquals(20, tp_1_2.getValue()); | |||
// In second set, we get a CharFlagsTextProp and a font.size and a font.color | |||
assertEquals(3,b_ch_2.getTextPropList().size()); | |||
TextProp tp_2_1 = (TextProp)b_ch_2.getTextPropList().get(0); | |||
TextProp tp_2_2 = (TextProp)b_ch_2.getTextPropList().get(1); | |||
TextProp tp_2_3 = (TextProp)b_ch_2.getTextPropList().get(2); | |||
TextProp tp_2_1 = b_ch_2.getTextPropList().get(0); | |||
TextProp tp_2_2 = b_ch_2.getTextPropList().get(1); | |||
TextProp tp_2_3 = b_ch_2.getTextPropList().get(2); | |||
assertEquals(true, tp_2_1 instanceof CharFlagsTextProp); | |||
assertEquals("font.size", tp_2_2.getName()); | |||
assertEquals("font.color", tp_2_3.getName()); | |||
@@ -238,17 +239,17 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// In third set, it's just a font.size and a font.color | |||
assertEquals(2,b_ch_3.getTextPropList().size()); | |||
TextProp tp_3_1 = (TextProp)b_ch_3.getTextPropList().get(0); | |||
TextProp tp_3_2 = (TextProp)b_ch_3.getTextPropList().get(1); | |||
TextProp tp_3_1 = b_ch_3.getTextPropList().get(0); | |||
TextProp tp_3_2 = b_ch_3.getTextPropList().get(1); | |||
assertEquals("font.size", tp_3_1.getName()); | |||
assertEquals("font.color", tp_3_2.getName()); | |||
assertEquals(20, tp_3_1.getValue()); | |||
// In fourth set, we get a CharFlagsTextProp and a font.index and a font.size | |||
assertEquals(3,b_ch_4.getTextPropList().size()); | |||
TextProp tp_4_1 = (TextProp)b_ch_4.getTextPropList().get(0); | |||
TextProp tp_4_2 = (TextProp)b_ch_4.getTextPropList().get(1); | |||
TextProp tp_4_3 = (TextProp)b_ch_4.getTextPropList().get(2); | |||
TextProp tp_4_1 = b_ch_4.getTextPropList().get(0); | |||
TextProp tp_4_2 = b_ch_4.getTextPropList().get(1); | |||
TextProp tp_4_3 = b_ch_4.getTextPropList().get(2); | |||
assertEquals(true, tp_4_1 instanceof CharFlagsTextProp); | |||
assertEquals("font.index", tp_4_2.getName()); | |||
assertEquals("font.size", tp_4_3.getName()); | |||
@@ -259,16 +260,16 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); | |||
stpb.setParentTextSize(data_b_text_len); | |||
LinkedList b_p_l = stpb.getParagraphStyles(); | |||
TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0); | |||
TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1); | |||
TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2); | |||
TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3); | |||
LinkedList<TextPropCollection> b_p_l = stpb.getParagraphStyles(); | |||
TextPropCollection b_p_1 = b_p_l.get(0); | |||
TextPropCollection b_p_2 = b_p_l.get(1); | |||
TextPropCollection b_p_3 = b_p_l.get(2); | |||
TextPropCollection b_p_4 = b_p_l.get(3); | |||
// 1st is left aligned + normal line spacing | |||
assertEquals(2,b_p_1.getTextPropList().size()); | |||
TextProp tp_1_1 = (TextProp)b_p_1.getTextPropList().get(0); | |||
TextProp tp_1_2 = (TextProp)b_p_1.getTextPropList().get(1); | |||
TextProp tp_1_1 = b_p_1.getTextPropList().get(0); | |||
TextProp tp_1_2 = b_p_1.getTextPropList().get(1); | |||
assertEquals("alignment", tp_1_1.getName()); | |||
assertEquals("linespacing", tp_1_2.getName()); | |||
assertEquals(0, tp_1_1.getValue()); | |||
@@ -276,14 +277,14 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// 2nd is centre aligned (default) + normal line spacing | |||
assertEquals(1,b_p_2.getTextPropList().size()); | |||
TextProp tp_2_1 = (TextProp)b_p_2.getTextPropList().get(0); | |||
TextProp tp_2_1 = b_p_2.getTextPropList().get(0); | |||
assertEquals("linespacing", tp_2_1.getName()); | |||
assertEquals(80, tp_2_1.getValue()); | |||
// 3rd is right aligned + normal line spacing | |||
assertEquals(2,b_p_3.getTextPropList().size()); | |||
TextProp tp_3_1 = (TextProp)b_p_3.getTextPropList().get(0); | |||
TextProp tp_3_2 = (TextProp)b_p_3.getTextPropList().get(1); | |||
TextProp tp_3_1 = b_p_3.getTextPropList().get(0); | |||
TextProp tp_3_2 = b_p_3.getTextPropList().get(1); | |||
assertEquals("alignment", tp_3_1.getName()); | |||
assertEquals("linespacing", tp_3_2.getName()); | |||
assertEquals(2, tp_3_1.getValue()); | |||
@@ -291,8 +292,8 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// 4st is left aligned + normal line spacing (despite differing font) | |||
assertEquals(2,b_p_4.getTextPropList().size()); | |||
TextProp tp_4_1 = (TextProp)b_p_4.getTextPropList().get(0); | |||
TextProp tp_4_2 = (TextProp)b_p_4.getTextPropList().get(1); | |||
TextProp tp_4_1 = b_p_4.getTextPropList().get(0); | |||
TextProp tp_4_2 = b_p_4.getTextPropList().get(1); | |||
assertEquals("alignment", tp_4_1.getName()); | |||
assertEquals("linespacing", tp_4_2.getName()); | |||
assertEquals(0, tp_4_1.getValue()); | |||
@@ -303,11 +304,11 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); | |||
stpb.setParentTextSize(data_b_text_len); | |||
LinkedList b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3); | |||
LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = b_ch_l.get(3); | |||
// 1st is bold | |||
CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0); | |||
@@ -374,17 +375,17 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); | |||
stpb.setParentTextSize(data_b_text_len); | |||
LinkedList b_p_l = stpb.getParagraphStyles(); | |||
TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0); | |||
TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1); | |||
TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2); | |||
TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3); | |||
LinkedList<TextPropCollection> b_p_l = stpb.getParagraphStyles(); | |||
TextPropCollection b_p_1 = b_p_l.get(0); | |||
TextPropCollection b_p_2 = b_p_l.get(1); | |||
TextPropCollection b_p_3 = b_p_l.get(2); | |||
TextPropCollection b_p_4 = b_p_l.get(3); | |||
LinkedList b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3); | |||
LinkedList<TextPropCollection> b_ch_l = stpb.getCharacterStyles(); | |||
TextPropCollection b_ch_1 = b_ch_l.get(0); | |||
TextPropCollection b_ch_2 = b_ch_l.get(1); | |||
TextPropCollection b_ch_3 = b_ch_l.get(2); | |||
TextPropCollection b_ch_4 = b_ch_l.get(3); | |||
// CharFlagsTextProp: 3 doesn't have, 4 does | |||
assertNull(b_ch_3.findByName("char_flags")); | |||
@@ -430,10 +431,10 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// Don't need to touch the paragraph styles | |||
// Add two more character styles | |||
LinkedList cs = stpa.getCharacterStyles(); | |||
LinkedList<TextPropCollection> cs = stpa.getCharacterStyles(); | |||
// First char style is boring, and 21 long | |||
TextPropCollection tpca = (TextPropCollection)cs.get(0); | |||
TextPropCollection tpca = cs.get(0); | |||
tpca.updateTextSize(21); | |||
// Second char style is coloured, 00 00 00 05, and 17 long | |||
@@ -467,10 +468,10 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// Need 4 paragraph styles | |||
LinkedList ps = stpa.getParagraphStyles(); | |||
LinkedList<TextPropCollection> ps = stpa.getParagraphStyles(); | |||
// First is 30 long, left aligned, normal spacing | |||
TextPropCollection tppa = (TextPropCollection)ps.get(0); | |||
TextPropCollection tppa = ps.get(0); | |||
tppa.updateTextSize(30); | |||
TextProp tp = tppa.addWithName("alignment"); | |||
@@ -502,10 +503,10 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// Now do 4 character styles | |||
LinkedList cs = stpa.getCharacterStyles(); | |||
LinkedList<TextPropCollection> cs = stpa.getCharacterStyles(); | |||
// First is 30 long, bold and font size | |||
TextPropCollection tpca = (TextPropCollection)cs.get(0); | |||
TextPropCollection tpca = cs.get(0); | |||
tpca.updateTextSize(30); | |||
tp = tpca.addWithName("font.size"); | |||
@@ -567,16 +568,16 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
// Compare in detail to b | |||
StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length); | |||
stpb.setParentTextSize(data_b_text_len); | |||
LinkedList psb = stpb.getParagraphStyles(); | |||
LinkedList csb = stpb.getCharacterStyles(); | |||
LinkedList<TextPropCollection> psb = stpb.getParagraphStyles(); | |||
LinkedList<TextPropCollection> csb = stpb.getCharacterStyles(); | |||
assertEquals(psb.size(), ps.size()); | |||
assertEquals(csb.size(), cs.size()); | |||
// Ensure Paragraph Character styles match | |||
for(int z=0; z<2; z++) { | |||
LinkedList lla = cs; | |||
LinkedList llb = csb; | |||
LinkedList<TextPropCollection> lla = cs; | |||
LinkedList<TextPropCollection> llb = csb; | |||
int upto = 5; | |||
if(z == 1) { | |||
lla = ps; | |||
@@ -585,15 +586,15 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
} | |||
for(int i=0; i<upto; i++) { | |||
TextPropCollection ca = (TextPropCollection)lla.get(i); | |||
TextPropCollection cb = (TextPropCollection)llb.get(i); | |||
TextPropCollection ca = lla.get(i); | |||
TextPropCollection cb = llb.get(i); | |||
assertEquals(ca.getCharactersCovered(), cb.getCharactersCovered()); | |||
assertEquals(ca.getTextPropList().size(), cb.getTextPropList().size()); | |||
for(int j=0; j<ca.getTextPropList().size(); j++) { | |||
TextProp tpa = (TextProp)ca.getTextPropList().get(j); | |||
TextProp tpb = (TextProp)cb.getTextPropList().get(j); | |||
TextProp tpa = ca.getTextPropList().get(j); | |||
TextProp tpb = cb.getTextPropList().get(j); | |||
//System.out.println("TP " + i + " " + j + " " + tpa.getName() + "\t" + tpa.getValue() ); | |||
assertEquals(tpa.getName(), tpb.getName()); | |||
assertEquals(tpa.getMask(), tpb.getMask()); | |||
@@ -670,7 +671,7 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
assertEquals(data.length, bytes.length); | |||
try { | |||
assertTrue(Arrays.equals(data, bytes)); | |||
assertArrayEquals(data, bytes); | |||
} catch (Throwable e){ | |||
//print hex dump if failed | |||
assertEquals(HexDump.toHex(data), HexDump.toHex(bytes)); | |||
@@ -694,12 +695,12 @@ public final class TestStyleTextPropAtom extends TestCase { | |||
StyleTextPropAtom atom = new StyleTextPropAtom(data_d, 0, data_d.length); | |||
atom.setParentTextSize(data_d_text_len); | |||
TextPropCollection prprops = (TextPropCollection)atom.getParagraphStyles().getFirst(); | |||
TextPropCollection prprops = atom.getParagraphStyles().getFirst(); | |||
assertEquals(data_d_text_len+1, prprops.getCharactersCovered()); | |||
assertEquals(1, prprops.getTextPropList().size()); //1 property found | |||
assertEquals(1, prprops.findByName("alignment").getValue()); | |||
TextPropCollection chprops = (TextPropCollection)atom.getCharacterStyles().getFirst(); | |||
TextPropCollection chprops = atom.getCharacterStyles().getFirst(); | |||
assertEquals(data_d_text_len+1, chprops.getCharactersCovered()); | |||
assertEquals(5, chprops.getTextPropList().size()); //5 properties found | |||
assertEquals(1, chprops.findByName("char_flags").getValue()); |
@@ -17,8 +17,9 @@ | |||
package org.apache.poi.hslf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
@@ -51,10 +52,10 @@ public final class TestTextRulerAtom extends TestCase { | |||
assertNull(tabStops); | |||
int[] textOffsets = ruler.getTextOffsets(); | |||
assertTrue(Arrays.equals(new int[]{226, 451, 903, 1129, 1526}, textOffsets)); | |||
assertArrayEquals(new int[]{226, 451, 903, 1129, 1526}, textOffsets); | |||
int[] bulletOffsets = ruler.getBulletOffsets(); | |||
assertTrue(Arrays.equals(new int[]{117, 345, 794, 1016, 1526}, bulletOffsets)); | |||
assertArrayEquals(new int[]{117, 345, 794, 1016, 1526}, bulletOffsets); | |||
} | |||
@@ -64,7 +65,7 @@ public final class TestTextRulerAtom extends TestCase { | |||
ruler.writeOut(out); | |||
byte[] result = out.toByteArray(); | |||
assertTrue(Arrays.equals(result, data_1)); | |||
assertArrayEquals(result, data_1); | |||
} | |||
public void testRead2() throws Exception { | |||
@@ -74,6 +75,6 @@ public final class TestTextRulerAtom extends TestCase { | |||
ruler.writeOut(out); | |||
byte[] result = out.toByteArray(); | |||
assertTrue(Arrays.equals(result, data_2)); | |||
assertArrayEquals(result, data_2); | |||
} | |||
} |
@@ -17,8 +17,9 @@ | |||
package org.apache.poi.hslf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
@@ -58,7 +59,7 @@ public final class TestTextSpecInfoAtom extends TestCase { | |||
spec.writeOut(out); | |||
byte[] result = out.toByteArray(); | |||
assertTrue(Arrays.equals(result, data_1)); | |||
assertArrayEquals(result, data_1); | |||
} | |||
public void testReset() throws Exception { |
@@ -17,15 +17,25 @@ | |||
package org.apache.poi.hslf.usermodel; | |||
import org.apache.poi.hslf.*; | |||
import org.apache.poi.hslf.blip.*; | |||
import org.apache.poi.hslf.model.*; | |||
import org.apache.poi.POIDataSamples; | |||
import junit.framework.TestCase; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.*; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.net.URL; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.POIDataSamples; | |||
import org.apache.poi.hslf.HSLFSlideShow; | |||
import org.apache.poi.hslf.blip.DIB; | |||
import org.apache.poi.hslf.blip.EMF; | |||
import org.apache.poi.hslf.blip.JPEG; | |||
import org.apache.poi.hslf.blip.PICT; | |||
import org.apache.poi.hslf.blip.PNG; | |||
import org.apache.poi.hslf.blip.WMF; | |||
import org.apache.poi.hslf.model.Picture; | |||
import org.apache.poi.hslf.model.Shape; | |||
import org.apache.poi.hslf.model.Slide; | |||
/** | |||
* Test adding/reading pictures | |||
@@ -79,7 +89,7 @@ public final class TestPictures extends TestCase{ | |||
System.arraycopy(src_bytes, 512, b1, 0, b1.length); | |||
byte[] b2 = new byte[ppt_bytes.length-512]; | |||
System.arraycopy(ppt_bytes, 512, b2, 0, b2.length); | |||
assertTrue(Arrays.equals(b1, b2)); | |||
assertArrayEquals(b1, b2); | |||
} | |||
/** | |||
@@ -124,7 +134,7 @@ public final class TestPictures extends TestCase{ | |||
System.arraycopy(src_bytes, 22, b1, 0, b1.length); | |||
byte[] b2 = new byte[ppt_bytes.length-22]; | |||
System.arraycopy(ppt_bytes, 22, b2, 0, b2.length); | |||
assertTrue(Arrays.equals(b1, b2)); | |||
assertArrayEquals(b1, b2); | |||
} | |||
/** | |||
@@ -164,7 +174,7 @@ public final class TestPictures extends TestCase{ | |||
assertTrue(pictures[0] instanceof EMF); | |||
//compare the content of the initial file with what is stored in the PictureData | |||
byte[] ppt_bytes = pictures[0].getData(); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
} | |||
/** | |||
@@ -203,7 +213,7 @@ public final class TestPictures extends TestCase{ | |||
assertTrue(pictures[0] instanceof PNG); | |||
//compare the content of the initial file with what is stored in the PictureData | |||
byte[] ppt_bytes = pictures[0].getData(); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
} | |||
/** | |||
@@ -243,7 +253,7 @@ public final class TestPictures extends TestCase{ | |||
assertTrue(pictures[0] instanceof JPEG); | |||
//compare the content of the initial file with what is stored in the PictureData | |||
byte[] ppt_bytes = pictures[0].getData(); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
} | |||
/** | |||
@@ -282,7 +292,7 @@ public final class TestPictures extends TestCase{ | |||
assertTrue(pictures[0] instanceof DIB); | |||
//compare the content of the initial file with what is stored in the PictureData | |||
byte[] ppt_bytes = pictures[0].getData(); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
} | |||
/** | |||
@@ -305,7 +315,7 @@ public final class TestPictures extends TestCase{ | |||
assertEquals(Picture.JPEG, pdata.getType()); | |||
src_bytes = pdata.getData(); | |||
ppt_bytes = slTests.readFile("clock.jpg"); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
pict = (Picture)slides[1].getShapes()[0]; //the second slide contains PNG | |||
pdata = pict.getPictureData(); | |||
@@ -313,7 +323,7 @@ public final class TestPictures extends TestCase{ | |||
assertEquals(Picture.PNG, pdata.getType()); | |||
src_bytes = pdata.getData(); | |||
ppt_bytes = slTests.readFile("tomcat.png"); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
pict = (Picture)slides[2].getShapes()[0]; //the third slide contains WMF | |||
pdata = pict.getPictureData(); | |||
@@ -327,7 +337,7 @@ public final class TestPictures extends TestCase{ | |||
System.arraycopy(src_bytes, 22, b1, 0, b1.length); | |||
b2 = new byte[ppt_bytes.length-22]; | |||
System.arraycopy(ppt_bytes, 22, b2, 0, b2.length); | |||
assertTrue(Arrays.equals(b1, b2)); | |||
assertArrayEquals(b1, b2); | |||
pict = (Picture)slides[3].getShapes()[0]; //the forth slide contains PICT | |||
pdata = pict.getPictureData(); | |||
@@ -341,7 +351,7 @@ public final class TestPictures extends TestCase{ | |||
System.arraycopy(src_bytes, 512, b1, 0, b1.length); | |||
b2 = new byte[ppt_bytes.length-512]; | |||
System.arraycopy(ppt_bytes, 512, b2, 0, b2.length); | |||
assertTrue(Arrays.equals(b1, b2)); | |||
assertArrayEquals(b1, b2); | |||
pict = (Picture)slides[4].getShapes()[0]; //the fifth slide contains EMF | |||
pdata = pict.getPictureData(); | |||
@@ -349,7 +359,7 @@ public final class TestPictures extends TestCase{ | |||
assertEquals(Picture.EMF, pdata.getType()); | |||
src_bytes = pdata.getData(); | |||
ppt_bytes = slTests.readFile("wrench.emf"); | |||
assertTrue(Arrays.equals(src_bytes, ppt_bytes)); | |||
assertArrayEquals(src_bytes, ppt_bytes); | |||
} | |||
@@ -17,9 +17,9 @@ | |||
package org.apache.poi.hslf.usermodel; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.POIDataSamples; | |||
/** | |||
@@ -42,6 +42,6 @@ public final class TestSoundData extends TestCase{ | |||
SoundData[] sound = ppt.getSoundData(); | |||
assertEquals("Expected 1 sound", 1, sound.length); | |||
assertTrue(Arrays.equals(ref_data, sound[0].getData())); | |||
assertArrayEquals(ref_data, sound[0].getData()); | |||
} | |||
} |
@@ -17,12 +17,14 @@ | |||
package org.apache.poi.ddf; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.POIDataSamples; | |||
/** | |||
@@ -44,20 +46,20 @@ public final class TestEscherBlipRecord extends TestCase { | |||
EscherBSERecord bse1 = (EscherBSERecord)bstore.getChild(0); | |||
assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeWin32()); | |||
assertEquals(EscherBSERecord.BT_PNG, bse1.getBlipTypeMacOS()); | |||
assertTrue(Arrays.equals(new byte[]{ | |||
assertArrayEquals(new byte[]{ | |||
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC, | |||
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2 | |||
}, bse1.getUid())); | |||
}, bse1.getUid()); | |||
assertEquals(255, bse1.getTag()); | |||
assertEquals(32308, bse1.getSize()); | |||
EscherBitmapBlip blip1 = (EscherBitmapBlip)bse1.getBlipRecord(); | |||
assertEquals(0x6E00, blip1.getOptions()); | |||
assertEquals(EscherBitmapBlip.RECORD_ID_PNG, blip1.getRecordId()); | |||
assertTrue(Arrays.equals(new byte[]{ | |||
assertArrayEquals(new byte[]{ | |||
0x65, 0x07, 0x4A, (byte)0x8D, 0x3E, 0x42, (byte)0x8B, (byte)0xAC, | |||
0x1D, (byte)0x89, 0x35, 0x4F, 0x48, (byte)0xFA, 0x37, (byte)0xC2 | |||
}, blip1.getUID())); | |||
}, blip1.getUID()); | |||
//serialize and read again | |||
byte[] ser = bse1.serialize(); | |||
@@ -66,7 +68,7 @@ public final class TestEscherBlipRecord extends TestCase { | |||
assertEquals(bse1.getRecordId(), bse2.getRecordId()); | |||
assertEquals(bse1.getBlipTypeWin32(), bse2.getBlipTypeWin32()); | |||
assertEquals(bse1.getBlipTypeMacOS(), bse2.getBlipTypeMacOS()); | |||
assertTrue(Arrays.equals(bse1.getUid(), bse2.getUid())); | |||
assertArrayEquals(bse1.getUid(), bse2.getUid()); | |||
assertEquals(bse1.getTag(), bse2.getTag()); | |||
assertEquals(bse1.getSize(), bse2.getSize()); | |||
@@ -75,7 +77,7 @@ public final class TestEscherBlipRecord extends TestCase { | |||
assertEquals(blip1.getRecordId(), blip2.getRecordId()); | |||
assertEquals(blip1.getUID(), blip2.getUID()); | |||
assertTrue(Arrays.equals(blip1.getPicturedata(), blip1.getPicturedata())); | |||
assertArrayEquals(blip1.getPicturedata(), blip1.getPicturedata()); | |||
} | |||
//test reading/serializing of a PICT metafile | |||
@@ -90,24 +92,24 @@ public final class TestEscherBlipRecord extends TestCase { | |||
//System.out.println(bse1); | |||
assertEquals(EscherBSERecord.BT_WMF, bse1.getBlipTypeWin32()); | |||
assertEquals(EscherBSERecord.BT_PICT, bse1.getBlipTypeMacOS()); | |||
assertTrue(Arrays.equals(new byte[]{ | |||
assertArrayEquals(new byte[]{ | |||
(byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F, | |||
0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13 | |||
}, bse1.getUid())); | |||
}, bse1.getUid()); | |||
assertEquals(255, bse1.getTag()); | |||
assertEquals(1133, bse1.getSize()); | |||
EscherMetafileBlip blip1 = (EscherMetafileBlip)bse1.getBlipRecord(); | |||
assertEquals(0x5430, blip1.getOptions()); | |||
assertEquals(EscherMetafileBlip.RECORD_ID_PICT, blip1.getRecordId()); | |||
assertTrue(Arrays.equals(new byte[]{ | |||
assertArrayEquals(new byte[]{ | |||
0x57, 0x32, 0x7B, (byte)0x91, 0x23, 0x5D, (byte)0xDB, 0x36, | |||
0x7A, (byte)0xDB, (byte)0xFF, 0x17, (byte)0xFE, (byte)0xF3, (byte)0xA7, 0x05 | |||
}, blip1.getUID())); | |||
assertTrue(Arrays.equals(new byte[]{ | |||
}, blip1.getUID()); | |||
assertArrayEquals(new byte[]{ | |||
(byte)0xC7, 0x15, 0x69, 0x2D, (byte)0xE5, (byte)0x89, (byte)0xA3, 0x6F, | |||
0x66, 0x03, (byte)0xD6, 0x24, (byte)0xF7, (byte)0xDB, 0x1D, 0x13 | |||
}, blip1.getPrimaryUID())); | |||
}, blip1.getPrimaryUID()); | |||
//serialize and read again | |||
byte[] ser = bse1.serialize(); | |||
@@ -117,7 +119,7 @@ public final class TestEscherBlipRecord extends TestCase { | |||
assertEquals(bse1.getOptions(), bse2.getOptions()); | |||
assertEquals(bse1.getBlipTypeWin32(), bse2.getBlipTypeWin32()); | |||
assertEquals(bse1.getBlipTypeMacOS(), bse2.getBlipTypeMacOS()); | |||
assertTrue(Arrays.equals(bse1.getUid(), bse2.getUid())); | |||
assertArrayEquals(bse1.getUid(), bse2.getUid()); | |||
assertEquals(bse1.getTag(), bse2.getTag()); | |||
assertEquals(bse1.getSize(), bse2.getSize()); | |||
@@ -127,7 +129,7 @@ public final class TestEscherBlipRecord extends TestCase { | |||
assertEquals(blip1.getUID(), blip2.getUID()); | |||
assertEquals(blip1.getPrimaryUID(), blip2.getPrimaryUID()); | |||
assertTrue(Arrays.equals(blip1.getPicturedata(), blip1.getPicturedata())); | |||
assertArrayEquals(blip1.getPicturedata(), blip1.getPicturedata()); | |||
} | |||
//integral test: check that the read-write-read round trip is consistent | |||
@@ -138,7 +140,7 @@ public final class TestEscherBlipRecord extends TestCase { | |||
record.fillFields(data, 0, new DefaultEscherRecordFactory()); | |||
byte[] ser = record.serialize(); | |||
assertTrue(Arrays.equals(data, ser)); | |||
assertArrayEquals(data, ser); | |||
} | |||
private byte[] read(File file) { | |||
@@ -169,6 +171,6 @@ public final class TestEscherBlipRecord extends TestCase { | |||
assertNotNull(remaining); | |||
byte[] ser = bse.serialize(); //serialize and assert against the source data | |||
assertTrue(Arrays.equals(data, ser)); | |||
assertArrayEquals(data, ser); | |||
} | |||
} |
@@ -17,11 +17,11 @@ | |||
package org.apache.poi.ddf; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.util.HexRead; | |||
import org.apache.poi.util.HexDump; | |||
import java.util.Arrays; | |||
import org.apache.poi.util.HexDump; | |||
import org.apache.poi.util.HexRead; | |||
public final class TestEscherOptRecord extends TestCase { | |||
@@ -299,7 +299,7 @@ public final class TestEscherOptRecord extends TestCase { | |||
opt2.fillFields( data1, new DefaultEscherRecordFactory() ); | |||
byte[] data2 = opt2.serialize(); | |||
assertTrue(Arrays.equals(data1, data2)); | |||
assertArrayEquals(data1, data2); | |||
} | |||
/** | |||
@@ -319,6 +319,6 @@ public final class TestEscherOptRecord extends TestCase { | |||
assertEquals(0, p.getNumberOfElementsInArray()); | |||
byte[] data2 = opt2.serialize(); | |||
assertTrue(Arrays.equals(data1, data2)); | |||
assertArrayEquals(data1, data2); | |||
} | |||
} |
@@ -16,6 +16,8 @@ | |||
==================================================================== */ | |||
package org.apache.poi.hssf.model; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
@@ -169,6 +171,7 @@ public class TestDrawingAggregate extends TestCase { | |||
public void testAllTestSamples(){ | |||
File[] xls = new File(System.getProperty("POI.testdata.path"), "spreadsheet").listFiles( | |||
new FilenameFilter() { | |||
@Override | |||
public boolean accept(File dir, String name) { | |||
return name.endsWith(".xls"); | |||
} | |||
@@ -471,7 +474,7 @@ public class TestDrawingAggregate extends TestCase { | |||
assertEquals(r1.getRecordSize(), r2.getRecordSize()); | |||
if (r1 instanceof Record) { | |||
assertEquals(((Record) r1).getSid(), ((Record) r2).getSid()); | |||
assertTrue(Arrays.equals(((Record) r1).serialize(), ((Record) r2).serialize())); | |||
assertArrayEquals(((Record) r1).serialize(), ((Record) r2).serialize()); | |||
} | |||
} | |||
} |
@@ -17,49 +17,13 @@ | |||
package org.apache.poi.hssf.model; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hssf.HSSFTestDataSamples; | |||
import org.apache.poi.hssf.record.NameRecord; | |||
import org.apache.poi.hssf.record.common.UnicodeString; | |||
import org.apache.poi.ss.formula.constant.ErrorConstant; | |||
import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg; | |||
import org.apache.poi.ss.formula.ptg.AddPtg; | |||
import org.apache.poi.ss.formula.ptg.Area3DPtg; | |||
import org.apache.poi.ss.formula.ptg.AreaI; | |||
import org.apache.poi.ss.formula.ptg.AreaPtg; | |||
import org.apache.poi.ss.formula.ptg.AreaPtgBase; | |||
import org.apache.poi.ss.formula.ptg.ArrayPtg; | |||
import org.apache.poi.ss.formula.ptg.AttrPtg; | |||
import org.apache.poi.ss.formula.ptg.BoolPtg; | |||
import org.apache.poi.ss.formula.ptg.ConcatPtg; | |||
import org.apache.poi.ss.formula.ptg.DividePtg; | |||
import org.apache.poi.ss.formula.ptg.EqualPtg; | |||
import org.apache.poi.ss.formula.ptg.ErrPtg; | |||
import org.apache.poi.ss.formula.ptg.FuncPtg; | |||
import org.apache.poi.ss.formula.ptg.FuncVarPtg; | |||
import org.apache.poi.ss.formula.ptg.IntPtg; | |||
import org.apache.poi.ss.formula.ptg.MemAreaPtg; | |||
import org.apache.poi.ss.formula.ptg.MemFuncPtg; | |||
import org.apache.poi.ss.formula.ptg.MissingArgPtg; | |||
import org.apache.poi.ss.formula.ptg.MultiplyPtg; | |||
import org.apache.poi.ss.formula.ptg.NamePtg; | |||
import org.apache.poi.ss.formula.ptg.NumberPtg; | |||
import org.apache.poi.ss.formula.ptg.ParenthesisPtg; | |||
import org.apache.poi.ss.formula.ptg.PercentPtg; | |||
import org.apache.poi.ss.formula.ptg.PowerPtg; | |||
import org.apache.poi.ss.formula.ptg.Ptg; | |||
import org.apache.poi.ss.formula.ptg.RangePtg; | |||
import org.apache.poi.ss.formula.ptg.Ref3DPtg; | |||
import org.apache.poi.ss.formula.ptg.RefPtg; | |||
import org.apache.poi.ss.formula.ptg.StringPtg; | |||
import org.apache.poi.ss.formula.ptg.SubtractPtg; | |||
import org.apache.poi.ss.formula.ptg.UnaryMinusPtg; | |||
import org.apache.poi.ss.formula.ptg.UnaryPlusPtg; | |||
import org.apache.poi.ss.formula.ptg.UnionPtg; | |||
import org.apache.poi.hssf.usermodel.FormulaExtractor; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFErrorConstants; | |||
@@ -72,6 +36,8 @@ import org.apache.poi.hssf.usermodel.TestHSSFName; | |||
import org.apache.poi.ss.formula.FormulaParseException; | |||
import org.apache.poi.ss.formula.FormulaParser; | |||
import org.apache.poi.ss.formula.FormulaType; | |||
import org.apache.poi.ss.formula.constant.ErrorConstant; | |||
import org.apache.poi.ss.formula.ptg.*; | |||
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues; | |||
import org.apache.poi.ss.usermodel.Name; | |||
import org.apache.poi.util.HexRead; | |||
@@ -909,7 +875,7 @@ public final class TestFormulaParser extends TestCase { | |||
+ "00 00 00 " // Array data: 1 col, 1 row | |||
+ "02 01 00 00 35" // elem (type=string, len=1, "5") | |||
); | |||
assertTrue(Arrays.equals(expData, data)); | |||
assertArrayEquals(expData, data); | |||
int initSize = Ptg.getEncodedSizeWithoutArrayData(ptgs); | |||
Ptg[] ptgs2 = Ptg.readTokens(initSize, new LittleEndianByteArrayInputStream(data)); | |||
confirmTokenClasses(ptgs2, ArrayPtg.class, IntPtg.class, FuncVarPtg.class); |
@@ -17,8 +17,8 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import java.util.Arrays; | |||
/** | |||
* Tests the AutoFilterInfoRecord class. | |||
@@ -62,6 +62,6 @@ public final class TestAutoFilterInfoRecord extends TestCase { | |||
byte[] cln = cloned.serialize(); | |||
assertEquals(record.getDataSize(), cloned.getDataSize()); | |||
assertTrue(Arrays.equals(src, cln)); | |||
assertArrayEquals(src, cln); | |||
} | |||
} |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -80,6 +79,6 @@ public final class TestBoolErrRecord extends TestCase { | |||
"00 00 00 00 0F 00 " + | |||
"01 00 " // normal number of data bytes | |||
); | |||
assertTrue(Arrays.equals(expData, outData)); | |||
assertArrayEquals(expData, outData); | |||
} | |||
} |
@@ -17,15 +17,16 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.apache.poi.util.HexRead; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.util.HexRead; | |||
/** | |||
* Tests BoundSheetRecord. | |||
* | |||
@@ -76,7 +77,7 @@ public final class TestBoundSheetRecord extends TestCase { | |||
assertEquals("\u0421\u0442\u0440\u0430\u043D\u0438\u0447\u043A\u0430", bsr.getSheetname()); | |||
byte[] data2 = bsr.serialize(); | |||
assertTrue(Arrays.equals(data, data2)); | |||
assertArrayEquals(data, data2); | |||
} | |||
public void testOrdering() { |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -45,7 +44,7 @@ public final class TestColumnInfoRecord extends TestCase { | |||
assertEquals(true, cir.getHidden()); | |||
assertEquals(3, cir.getOutlineLevel()); | |||
assertEquals(true, cir.getCollapsed()); | |||
assertTrue(Arrays.equals(data, cir.serialize())); | |||
assertArrayEquals(data, cir.serialize()); | |||
} | |||
/** | |||
@@ -69,7 +68,7 @@ public final class TestColumnInfoRecord extends TestCase { | |||
throw e; | |||
} | |||
assertEquals(0, in.remaining()); | |||
assertTrue(Arrays.equals(outData, cir.serialize())); | |||
assertArrayEquals(outData, cir.serialize()); | |||
} | |||
/** | |||
@@ -83,6 +82,6 @@ public final class TestColumnInfoRecord extends TestCase { | |||
RecordInputStream in = TestcaseRecordInputStream.create(inpData); | |||
ColumnInfoRecord cir = new ColumnInfoRecord(in); | |||
assertEquals(0, in.remaining()); | |||
assertTrue(Arrays.equals(outData, cir.serialize())); | |||
assertArrayEquals(outData, cir.serialize()); | |||
} | |||
} |
@@ -17,6 +17,8 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
@@ -31,6 +33,7 @@ public final class TestDrawingRecord extends TestCase { | |||
* Check that RecordFactoryInputStream properly handles continued DrawingRecords | |||
* See Bugzilla #47548 | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public void testReadContinued() throws IOException { | |||
//simulate a continues drawing record | |||
@@ -53,8 +56,8 @@ public final class TestDrawingRecord extends TestCase { | |||
assertTrue(rec.get(0) instanceof DrawingRecord); | |||
assertTrue(rec.get(1) instanceof ContinueRecord); | |||
assertTrue(Arrays.equals(data1, ((DrawingRecord)rec.get(0)).getData())); | |||
assertTrue(Arrays.equals(data2, ((ContinueRecord)rec.get(1)).getData())); | |||
assertArrayEquals(data1, ((DrawingRecord)rec.get(0)).getData()); | |||
assertArrayEquals(data2, ((ContinueRecord)rec.get(1)).getData()); | |||
} | |||
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -57,7 +56,7 @@ public final class TestEmbeddedObjectRefSubRecord extends TestCase { | |||
assertEquals(record1.getOLEClassName(), record2.getOLEClassName()); | |||
byte[] ser2 = record1.serialize(); | |||
assertTrue(Arrays.equals(ser, ser2)); | |||
assertArrayEquals(ser, ser2); | |||
} | |||
/** | |||
@@ -85,7 +84,7 @@ public final class TestEmbeddedObjectRefSubRecord extends TestCase { | |||
assertEquals(record1.getStreamId(), record2.getStreamId()); | |||
byte[] ser2 = record1.serialize(); | |||
assertTrue(Arrays.equals(ser, ser2)); | |||
assertArrayEquals(ser, ser2); | |||
} | |||
public void testCameraTool_bug45912() { |
@@ -18,10 +18,9 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import java.util.Arrays; | |||
/** | |||
* Tests the serialization and deserialization of the FtCblsSubRecord | |||
* class works correctly. | |||
@@ -61,6 +60,6 @@ public final class TestFtCblsSubRecord extends TestCase { | |||
byte[] cln = cloned.serialize(); | |||
assertEquals(record.getDataSize(), cloned.getDataSize()); | |||
assertTrue(Arrays.equals(src, cln)); | |||
assertArrayEquals(src, cln); | |||
} | |||
} |
@@ -16,8 +16,7 @@ | |||
==================================================================== */ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -345,7 +344,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
link = new HyperlinkRecord(is); | |||
byte[] bytes2 = link.serialize(); | |||
assertEquals(bytes1.length, bytes2.length); | |||
assertTrue(Arrays.equals(bytes1, bytes2)); | |||
assertArrayEquals(bytes1, bytes2); | |||
} | |||
public void testSerialize(){ | |||
@@ -367,7 +366,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
byte[] ser = new byte[tmp.length-4]; | |||
System.arraycopy(tmp, 4, ser, 0, ser.length); | |||
assertEquals(data1.length, ser.length); | |||
assertTrue(Arrays.equals(data1, ser)); | |||
assertArrayEquals(data1, ser); | |||
} | |||
public void testCreateFileRecord() { | |||
@@ -382,7 +381,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
byte[] ser = new byte[tmp.length-4]; | |||
System.arraycopy(tmp, 4, ser, 0, ser.length); | |||
assertEquals(data2.length, ser.length); | |||
assertTrue(Arrays.equals(data2, ser)); | |||
assertArrayEquals(data2, ser); | |||
} | |||
public void testCreateDocumentRecord() { | |||
@@ -397,7 +396,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
byte[] ser = new byte[tmp.length-4]; | |||
System.arraycopy(tmp, 4, ser, 0, ser.length); | |||
assertEquals(data4.length, ser.length); | |||
assertTrue(Arrays.equals(data4, ser)); | |||
assertArrayEquals(data4, ser); | |||
} | |||
public void testCreateEmailtRecord() { | |||
@@ -412,7 +411,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
byte[] ser = new byte[tmp.length-4]; | |||
System.arraycopy(tmp, 4, ser, 0, ser.length); | |||
assertEquals(data3.length, ser.length); | |||
assertTrue(Arrays.equals(data3, ser)); | |||
assertArrayEquals(data3, ser); | |||
} | |||
public void testClone() { | |||
@@ -421,7 +420,7 @@ public final class TestHyperlinkRecord extends TestCase { | |||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data[i]); | |||
HyperlinkRecord link = new HyperlinkRecord(is); | |||
HyperlinkRecord clone = (HyperlinkRecord)link.clone(); | |||
assertTrue(Arrays.equals(link.serialize(), clone.serialize())); | |||
assertArrayEquals(link.serialize(), clone.serialize()); | |||
} | |||
} |
@@ -18,9 +18,11 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import java.io.IOException; | |||
import junit.framework.TestCase; | |||
@@ -143,10 +145,10 @@ public final class TestLbsDataSubRecord extends TestCase { | |||
RecordInputStream in2 = TestcaseRecordInputStream.create(ser); | |||
ObjRecord record2 = new ObjRecord(in2); | |||
byte[] ser2 = record2.serialize(); | |||
assertTrue(Arrays.equals(ser, ser2)); | |||
assertArrayEquals(ser, ser2); | |||
} | |||
public void test_LbsDropData(){ | |||
public void test_LbsDropData() throws IOException{ | |||
byte[] data = HexRead.readFromString( | |||
//LbsDropData | |||
"0A, 00, " + //flags | |||
@@ -157,12 +159,20 @@ public final class TestLbsDataSubRecord extends TestCase { | |||
"00"); //padding byte | |||
LittleEndianInputStream in = new LittleEndianInputStream(new ByteArrayInputStream(data)); | |||
LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in); | |||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |||
lbs.serialize(new LittleEndianOutputStream(baos)); | |||
assertTrue(Arrays.equals(data, baos.toByteArray())); | |||
try { | |||
LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in); | |||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |||
LittleEndianOutputStream out = new LittleEndianOutputStream(baos); | |||
try { | |||
lbs.serialize(out); | |||
assertArrayEquals(data, baos.toByteArray()); | |||
} finally { | |||
out.close(); | |||
} | |||
} finally { | |||
in.close(); | |||
} | |||
} | |||
} |
@@ -17,11 +17,10 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import java.util.Arrays; | |||
import org.apache.poi.util.HexRead; | |||
/** | |||
@@ -84,7 +83,7 @@ public final class TestNoteRecord extends TestCase { | |||
//finally check that the serialized data is the same | |||
byte[] src = record.serialize(); | |||
byte[] cln = cloned.serialize(); | |||
assertTrue(Arrays.equals(src, cln)); | |||
assertArrayEquals(src, cln); | |||
} | |||
public void testUnicodeAuthor() { |
@@ -18,10 +18,9 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import java.util.Arrays; | |||
/** | |||
* Tests the serialization and deserialization of the NoteRecord | |||
* class works correctly. Test data taken directly from a real | |||
@@ -63,6 +62,6 @@ public final class TestNoteStructureSubRecord extends TestCase { | |||
byte[] cln = cloned.serialize(); | |||
assertEquals(record.getDataSize(), cloned.getDataSize()); | |||
assertTrue(Arrays.equals(src, cln)); | |||
assertArrayEquals(src, cln); | |||
} | |||
} |
@@ -17,7 +17,8 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.util.List; | |||
import junit.framework.AssertionFailedError; | |||
@@ -76,7 +77,7 @@ public final class TestObjRecord extends TestCase { | |||
assertEquals(26, recordBytes.length - 4); | |||
byte[] subData = new byte[recdata.length]; | |||
System.arraycopy(recordBytes, 4, subData, 0, subData.length); | |||
assertTrue(Arrays.equals(recdata, subData)); | |||
assertArrayEquals(recdata, subData); | |||
} | |||
public void testConstruct() { |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -67,6 +66,6 @@ public final class TestRecalcIdRecord extends TestCase { | |||
throw e; | |||
} | |||
assertEquals(0, in.remaining()); | |||
assertTrue(Arrays.equals(r.serialize(), goodData)); | |||
assertArrayEquals(r.serialize(), goodData); | |||
} | |||
} |
@@ -17,11 +17,12 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.util.Arrays; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
@@ -200,7 +201,7 @@ public final class TestRecordFactory extends TestCase { | |||
byte[] ser = out.toByteArray(); | |||
assertEquals(data.length, ser.length); | |||
assertTrue(Arrays.equals(data, ser)); | |||
assertArrayEquals(data, ser); | |||
} | |||
public void testNonZeroPadding_bug46987() { |
@@ -17,11 +17,10 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import java.io.ByteArrayInputStream; | |||
import java.util.Arrays; | |||
import org.apache.poi.EncryptedDocumentException; | |||
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey; | |||
@@ -152,7 +151,7 @@ public final class TestRecordFactoryInputStream { | |||
private void confirmReadInitialRecords(RecordFactoryInputStream rfis) { | |||
assertEquals(BOFRecord.class, rfis.nextRecord().getClass()); | |||
WindowOneRecord rec1 = (WindowOneRecord) rfis.nextRecord(); | |||
assertTrue(Arrays.equals(HexRead.readFromString(SAMPLE_WINDOW1),rec1.serialize())); | |||
assertArrayEquals(HexRead.readFromString(SAMPLE_WINDOW1),rec1.serialize()); | |||
} | |||
private static RecordFactoryInputStream createRFIS(byte[] data) { |
@@ -17,6 +17,8 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.BufferedReader; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
@@ -96,7 +98,7 @@ public final class TestSSTRecord extends TestCase { | |||
assertEquals( 688, record.getNumUniqueStrings() ); | |||
assertEquals( 688, record.countStrings() ); | |||
ser_output = record.serialize(); | |||
assertTrue(Arrays.equals(origData, ser_output)); | |||
assertArrayEquals(origData, ser_output); | |||
// testing based on new bug report | |||
origData = concatHexDumps("BigSSTRecord2", "BigSSTRecord2CR1", "BigSSTRecord2CR2", "BigSSTRecord2CR3", | |||
@@ -120,7 +122,7 @@ public final class TestSSTRecord extends TestCase { | |||
// TODO - trivial differences in ContinueRecord break locations | |||
// Sample data should be checked against what most recent Excel version produces. | |||
// maybe tweaks are required in ContinuableRecordOutput | |||
assertTrue(Arrays.equals(origData, ser_output)); | |||
assertArrayEquals(origData, ser_output); | |||
} | |||
} | |||
@@ -19,8 +19,7 @@ | |||
package org.apache.poi.hssf.record; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -81,7 +80,7 @@ public final class TestSubRecord extends TestCase { | |||
throw new AssertionFailedError("Identified bug 45778"); | |||
} | |||
assertEquals(74, data2.length); | |||
assertTrue(Arrays.equals(dataAutoFilter, data2)); | |||
assertArrayEquals(dataAutoFilter, data2); | |||
} | |||
public void testReadManualComboWithFormula() { | |||
@@ -108,7 +107,7 @@ public final class TestSubRecord extends TestCase { | |||
throw new AssertionFailedError("Encoded data differs at index " + i); | |||
} | |||
} | |||
assertTrue(Arrays.equals(data, data2)); | |||
assertArrayEquals(data, data2); | |||
} | |||
/** |
@@ -17,14 +17,15 @@ | |||
package org.apache.poi.hssf.record; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hssf.usermodel.HSSFRichTextString; | |||
import org.apache.poi.ss.formula.ptg.Ptg; | |||
import org.apache.poi.ss.formula.ptg.RefPtg; | |||
import org.apache.poi.hssf.usermodel.HSSFRichTextString; | |||
import org.apache.poi.util.HexRead; | |||
import org.apache.poi.util.LittleEndian; | |||
@@ -73,7 +74,7 @@ public final class TestTextObjectRecord extends TestCase { | |||
byte [] ser = record.serialize(); | |||
assertEquals(ser.length , simpleData.length); | |||
assertTrue(Arrays.equals(simpleData, ser)); | |||
assertArrayEquals(simpleData, ser); | |||
//read again | |||
RecordInputStream is = TestcaseRecordInputStream.create(simpleData); | |||
@@ -147,7 +148,7 @@ public final class TestTextObjectRecord extends TestCase { | |||
//finally check that the serialized data is the same | |||
byte[] src = obj.serialize(); | |||
byte[] cln = cloned.serialize(); | |||
assertTrue(Arrays.equals(src, cln)); | |||
assertArrayEquals(src, cln); | |||
} | |||
/** similar to {@link #simpleData} but with link formula at end of TXO rec*/ | |||
@@ -189,6 +190,6 @@ public final class TestTextObjectRecord extends TestCase { | |||
byte [] data2 = rec.serialize(); | |||
assertEquals(linkData.length, data2.length); | |||
assertTrue(Arrays.equals(linkData, data2)); | |||
assertArrayEquals(linkData, data2); | |||
} | |||
} |
@@ -17,14 +17,16 @@ | |||
package org.apache.poi.hssf.record.aggregates; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.util.Arrays; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hssf.HSSFTestDataSamples; | |||
import org.apache.poi.hssf.model.RecordStream; | |||
import org.apache.poi.hssf.model.InternalSheet; | |||
import org.apache.poi.hssf.model.RecordStream; | |||
import org.apache.poi.hssf.record.*; | |||
import org.apache.poi.hssf.usermodel.HSSFPrintSetup; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
@@ -299,7 +301,7 @@ public final class TestPageSettingsBlock extends TestCase { | |||
Record[] outRecs = rc.getRecords(); | |||
// records were assembled in standard order, so this simple check is OK | |||
assertTrue(Arrays.equals(recs, outRecs)); | |||
assertArrayEquals(recs, outRecs); | |||
} | |||
public void testDuplicateHeaderFooter_bug48026() { | |||
@@ -368,14 +370,14 @@ public final class TestPageSettingsBlock extends TestCase { | |||
} | |||
HeaderFooterRecord hd1 = (HeaderFooterRecord)expectedRecs[4]; | |||
//GUID is zero | |||
assertTrue(Arrays.equals(new byte[16], hd1.getGuid())); | |||
assertArrayEquals(new byte[16], hd1.getGuid()); | |||
assertTrue(hd1.isCurrentSheet()); | |||
UserSViewBegin svb = (UserSViewBegin)expectedRecs[7]; | |||
HeaderFooterRecord hd2 = (HeaderFooterRecord)expectedRecs[9]; | |||
assertFalse(hd2.isCurrentSheet()); | |||
//GUIDs of HeaderFooterRecord and UserSViewBegin must be the same | |||
assertTrue(Arrays.equals(svb.getGuid(), hd2.getGuid())); | |||
assertArrayEquals(svb.getGuid(), hd2.getGuid()); | |||
} | |||
} |
@@ -17,10 +17,11 @@ | |||
package org.apache.poi.hssf.record.aggregates; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.zip.CRC32; | |||
@@ -185,7 +186,7 @@ public final class TestValueRecordsAggregate extends TestCase { | |||
valueRecord.visitCellsForRow(1, sv); | |||
valueRecord.visitCellsForRow(2, sv); | |||
assertEquals(actualArray.length, sv.getWriteIndex()); | |||
assertTrue(Arrays.equals(expectedArray, actualArray)); | |||
assertArrayEquals(expectedArray, actualArray); | |||
} | |||
private static BlankRecord newBlankRecord() { |
@@ -17,15 +17,14 @@ | |||
package org.apache.poi.hssf.record.chart; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hssf.record.RecordInputStream; | |||
import org.apache.poi.hssf.record.TestcaseRecordInputStream; | |||
import org.apache.poi.util.HexRead; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
/** | |||
* Tests for {@link ChartFormatRecord} Test data taken directly from a real | |||
* Excel file. | |||
@@ -56,6 +55,6 @@ public final class TestChartFormatRecord extends TestCase { | |||
assertEquals(24, record.getRecordSize()); | |||
byte[] data2 = record.serialize(); | |||
assertTrue(Arrays.equals(data, data2)); | |||
assertArrayEquals(data, data2); | |||
} | |||
} |
@@ -17,6 +17,11 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.ddf.EscherDgRecord; | |||
@@ -24,9 +29,6 @@ import org.apache.poi.ddf.EscherSpRecord; | |||
import org.apache.poi.hssf.record.EscherAggregate; | |||
import org.apache.poi.ss.util.CellRangeAddress; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
/** | |||
* Test the ability to clone a sheet. | |||
* If adding new records that belong to a sheet (as opposed to a book) | |||
@@ -104,7 +106,7 @@ public final class TestCloneSheet extends TestCase { | |||
assertEquals(agg1.serialize().length, agg2.serialize().length); | |||
assertEquals(agg1.toXml(""), agg2.toXml("")); | |||
assertTrue(Arrays.equals(agg1.serialize(), agg2.serialize())); | |||
assertArrayEquals(agg1.serialize(), agg2.serialize()); | |||
} | |||
public void testCloneComment() throws IOException { | |||
@@ -120,15 +122,15 @@ public final class TestCloneSheet extends TestCase { | |||
HSSFPatriarch p2 = sh2.getDrawingPatriarch(); | |||
HSSFComment c2 = (HSSFComment) p2.getChildren().get(0); | |||
assertTrue(Arrays.equals(c2.getTextObjectRecord().serialize(), c.getTextObjectRecord().serialize())); | |||
assertTrue(Arrays.equals(c2.getObjRecord().serialize(), c.getObjRecord().serialize())); | |||
assertTrue(Arrays.equals(c2.getNoteRecord().serialize(), c.getNoteRecord().serialize())); | |||
assertArrayEquals(c2.getTextObjectRecord().serialize(), c.getTextObjectRecord().serialize()); | |||
assertArrayEquals(c2.getObjRecord().serialize(), c.getObjRecord().serialize()); | |||
assertArrayEquals(c2.getNoteRecord().serialize(), c.getNoteRecord().serialize()); | |||
//everything except spRecord.shapeId must be the same | |||
assertFalse(Arrays.equals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize())); | |||
EscherSpRecord sp = (EscherSpRecord) c2.getEscherContainer().getChild(0); | |||
sp.setShapeId(1025); | |||
assertTrue(Arrays.equals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize())); | |||
assertArrayEquals(c2.getEscherContainer().serialize(), c.getEscherContainer().serialize()); | |||
} | |||
} |
@@ -17,7 +17,8 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
@@ -141,46 +142,34 @@ public final class TestHSSFPalette extends TestCase { | |||
HSSFPalette p = book.getCustomPalette(); | |||
/* first test the defaults */ | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 255, (short) 255, (short) 0}, // not [204, 255, 255] | |||
p.findSimilarColor((byte) 204, (byte) 255, (byte) 0).getTriplet() | |||
) | |||
); | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 153, (short) 204, (short) 0}, // not [128, 0, 0] | |||
p.findSimilarColor((byte) 128, (byte) 255, (byte) 0).getTriplet() | |||
) | |||
); | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 0, (short) 255, (short) 0}, // not [0, 51, 102] | |||
p.findSimilarColor((byte) 0, (byte) 255, (byte) 102).getTriplet() | |||
) | |||
); | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 0, (short) 102, (short) 204}, // not [255, 102, 0] | |||
p.findSimilarColor((byte) 0, (byte) 102, (byte) 255).getTriplet() | |||
) | |||
); | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 255, (short) 0, (short) 255}, // not [128, 0, 0] | |||
p.findSimilarColor((byte) 128, (byte) 0, (byte) 255).getTriplet() | |||
) | |||
); | |||
assertTrue( | |||
Arrays.equals( | |||
assertArrayEquals( | |||
new short[] {(short) 255, (short) 0, (short) 255}, // not [255, 255, 153] | |||
p.findSimilarColor((byte) 255, (byte) 0, (byte) 153).getTriplet() | |||
) | |||
); | |||
@@ -238,6 +227,7 @@ public final class TestHSSFPalette extends TestCase { | |||
*/ | |||
public void testGnumericStrings() { | |||
compareToDefaults(new ColorComparator() { | |||
@Override | |||
public void compare(HSSFColor expected, HSSFColor palette) | |||
{ | |||
assertEquals(expected.getHexString(), palette.getHexString()); | |||
@@ -256,6 +246,7 @@ public final class TestHSSFPalette extends TestCase { | |||
//should still match defaults; | |||
compareToDefaults(new ColorComparator() { | |||
@Override | |||
public void compare(HSSFColor expected, HSSFColor palette) | |||
{ | |||
short[] s1 = expected.getTriplet(); |
@@ -17,10 +17,9 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.apache.poi.POIDataSamples; | |||
@@ -77,7 +76,7 @@ public final class TestHSSFPicture extends BaseTestPicture { | |||
int idx1 = wb.addPicture(data1, Workbook.PICTURE_TYPE_JPEG); | |||
assertEquals(1, idx1); | |||
HSSFPicture p1 = dr.createPicture(anchor, idx1); | |||
assertTrue(Arrays.equals(data1, p1.getPictureData().getData())); | |||
assertArrayEquals(data1, p1.getPictureData().getData()); | |||
// register another one | |||
byte[] data2 = new byte[]{4, 5, 6}; | |||
@@ -85,25 +84,25 @@ public final class TestHSSFPicture extends BaseTestPicture { | |||
assertEquals(2, idx2); | |||
HSSFPicture p2 = dr.createPicture(anchor, idx2); | |||
assertEquals(2, dr.getChildren().size()); | |||
assertTrue(Arrays.equals(data2, p2.getPictureData().getData())); | |||
assertArrayEquals(data2, p2.getPictureData().getData()); | |||
// confirm that HSSFPatriarch.getChildren() returns two picture shapes | |||
assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData())); | |||
assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()); | |||
assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()); | |||
// write, read back and verify that our pictures are there | |||
wb = HSSFTestDataSamples.writeOutAndReadBack(wb); | |||
List<? extends PictureData> lst2 = wb.getAllPictures(); | |||
assertEquals(2, lst2.size()); | |||
assertTrue(Arrays.equals(data1, lst2.get(0).getData())); | |||
assertTrue(Arrays.equals(data2, lst2.get(1).getData())); | |||
assertArrayEquals(data1, lst2.get(0).getData()); | |||
assertArrayEquals(data2, lst2.get(1).getData()); | |||
// confirm that the pictures are in the Sheet's drawing | |||
sh = wb.getSheet("Pictures"); | |||
dr = sh.createDrawingPatriarch(); | |||
assertEquals(2, dr.getChildren().size()); | |||
assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData())); | |||
assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()); | |||
assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()); | |||
// add a third picture | |||
byte[] data3 = new byte[]{7, 8, 9}; | |||
@@ -111,20 +110,20 @@ public final class TestHSSFPicture extends BaseTestPicture { | |||
int idx3 = wb.addPicture(data3, Workbook.PICTURE_TYPE_JPEG); | |||
assertEquals(3, idx3); | |||
HSSFPicture p3 = dr.createPicture(anchor, idx3); | |||
assertTrue(Arrays.equals(data3, p3.getPictureData().getData())); | |||
assertArrayEquals(data3, p3.getPictureData().getData()); | |||
assertEquals(3, dr.getChildren().size()); | |||
assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData())); | |||
assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()); | |||
assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()); | |||
assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()); | |||
// write and read again | |||
wb = HSSFTestDataSamples.writeOutAndReadBack(wb); | |||
List<? extends PictureData> lst3 = wb.getAllPictures(); | |||
// all three should be there | |||
assertEquals(3, lst3.size()); | |||
assertTrue(Arrays.equals(data1, lst3.get(0).getData())); | |||
assertTrue(Arrays.equals(data2, lst3.get(1).getData())); | |||
assertTrue(Arrays.equals(data3, lst3.get(2).getData())); | |||
assertArrayEquals(data1, lst3.get(0).getData()); | |||
assertArrayEquals(data2, lst3.get(1).getData()); | |||
assertArrayEquals(data3, lst3.get(2).getData()); | |||
sh = wb.getSheet("Pictures"); | |||
dr = sh.createDrawingPatriarch(); | |||
@@ -136,25 +135,25 @@ public final class TestHSSFPicture extends BaseTestPicture { | |||
assertEquals(4, idx4); | |||
dr.createPicture(anchor, idx4); | |||
assertEquals(4, dr.getChildren().size()); | |||
assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData())); | |||
assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()); | |||
assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()); | |||
assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()); | |||
assertArrayEquals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData()); | |||
wb = HSSFTestDataSamples.writeOutAndReadBack(wb); | |||
List<? extends PictureData> lst4 = wb.getAllPictures(); | |||
assertEquals(4, lst4.size()); | |||
assertTrue(Arrays.equals(data1, lst4.get(0).getData())); | |||
assertTrue(Arrays.equals(data2, lst4.get(1).getData())); | |||
assertTrue(Arrays.equals(data3, lst4.get(2).getData())); | |||
assertTrue(Arrays.equals(data4, lst4.get(3).getData())); | |||
assertArrayEquals(data1, lst4.get(0).getData()); | |||
assertArrayEquals(data2, lst4.get(1).getData()); | |||
assertArrayEquals(data3, lst4.get(2).getData()); | |||
assertArrayEquals(data4, lst4.get(3).getData()); | |||
sh = wb.getSheet("Pictures"); | |||
dr = sh.createDrawingPatriarch(); | |||
assertEquals(4, dr.getChildren().size()); | |||
assertTrue(Arrays.equals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData())); | |||
assertTrue(Arrays.equals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData())); | |||
assertArrayEquals(data1, ((HSSFPicture)dr.getChildren().get(0)).getPictureData().getData()); | |||
assertArrayEquals(data2, ((HSSFPicture)dr.getChildren().get(1)).getPictureData().getData()); | |||
assertArrayEquals(data3, ((HSSFPicture)dr.getChildren().get(2)).getPictureData().getData()); | |||
assertArrayEquals(data4, ((HSSFPicture)dr.getChildren().get(3)).getPictureData().getData()); | |||
} | |||
public void testBSEPictureRef(){ | |||
@@ -256,12 +255,12 @@ public final class TestHSSFPicture extends BaseTestPicture { | |||
wb = HSSFTestDataSamples.writeOutAndReadBack(wb); | |||
byte pictureDataOut[] = wb.getAllPictures().get(0).getData(); | |||
assertTrue(Arrays.equals(pictureDataEmf, pictureDataOut)); | |||
assertArrayEquals(pictureDataEmf, pictureDataOut); | |||
byte wmfNoHeader[] = new byte[pictureDataWmf.length-22]; | |||
System.arraycopy(pictureDataWmf, 22, wmfNoHeader, 0, pictureDataWmf.length-22); | |||
pictureDataOut = wb.getAllPictures().get(2).getData(); | |||
assertTrue(Arrays.equals(wmfNoHeader, pictureDataOut)); | |||
assertArrayEquals(wmfNoHeader, pictureDataOut); | |||
} | |||
@@ -17,12 +17,13 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import junit.framework.TestCase; | |||
@@ -119,17 +120,17 @@ public final class TestOLE2Embeding extends TestCase { | |||
Ole10Native ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory()); | |||
bos.reset(); | |||
pptPoifs.writeFilesystem(bos); | |||
assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray())); | |||
assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray()); | |||
od = wb.getAllEmbeddedObjects().get(1); | |||
ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory()); | |||
bos.reset(); | |||
xlsPoifs.writeFilesystem(bos); | |||
assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray())); | |||
assertArrayEquals(ole10.getDataBuffer(), bos.toByteArray()); | |||
od = wb.getAllEmbeddedObjects().get(2); | |||
ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory()); | |||
assertTrue(Arrays.equals(ole10.getDataBuffer(), getSampleTXT())); | |||
assertArrayEquals(ole10.getDataBuffer(), getSampleTXT()); | |||
} | |||
@@ -17,7 +17,12 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.IOException; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.ddf.EscherArrayProperty; | |||
import org.apache.poi.ddf.EscherOptRecord; | |||
import org.apache.poi.ddf.EscherProperties; | |||
@@ -27,9 +32,6 @@ import org.apache.poi.hssf.model.HSSFTestModelHelper; | |||
import org.apache.poi.hssf.model.PolygonShape; | |||
import org.apache.poi.hssf.record.ObjRecord; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
/** | |||
* @author Evgeniy Berlog | |||
* @date 28.06.12 | |||
@@ -55,19 +57,19 @@ public class TestPolygon extends TestCase{ | |||
byte[] actual = polygon.getEscherContainer().getChild(0).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
expected = polygonShape.getSpContainer().getChild(2).serialize(); | |||
actual = polygon.getEscherContainer().getChild(2).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
expected = polygonShape.getSpContainer().getChild(3).serialize(); | |||
actual = polygon.getEscherContainer().getChild(3).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
ObjRecord obj = polygon.getObjRecord(); | |||
ObjRecord objShape = polygonShape.getObjRecord(); | |||
@@ -76,7 +78,7 @@ public class TestPolygon extends TestCase{ | |||
actual = objShape.serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
} | |||
public void testPolygonPoints(){ | |||
@@ -98,8 +100,8 @@ public class TestPolygon extends TestCase{ | |||
assertEquals(verticesProp1.toXml(""), verticesProp2.toXml("")); | |||
polygon.setPoints(new int[]{1,2,3}, new int[] {4,5,6}); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6}); | |||
polygonShape = HSSFTestModelHelper.createPolygonShape(0, polygon); | |||
verticesProp1 = polygon.getOptRecord().lookup(EscherProperties.GEOMETRY__VERTICES); | |||
@@ -119,8 +121,8 @@ public class TestPolygon extends TestCase{ | |||
polygon.setPolygonDrawArea( 102, 101 ); | |||
polygon.setPoints( new int[]{1,2,3}, new int[]{4,5,6} ); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1,2,3})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{1,2,3}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6}); | |||
assertEquals(polygon.getDrawAreaHeight(), 101); | |||
assertEquals(polygon.getDrawAreaWidth(), 102); | |||
@@ -129,16 +131,16 @@ public class TestPolygon extends TestCase{ | |||
patriarch = sh.getDrawingPatriarch(); | |||
polygon = (HSSFPolygon) patriarch.getChildren().get(0); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4, 5, 6})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{4, 5, 6}); | |||
assertEquals(polygon.getDrawAreaHeight(), 101); | |||
assertEquals(polygon.getDrawAreaWidth(), 102); | |||
polygon.setPolygonDrawArea( 1021, 1011 ); | |||
polygon.setPoints( new int[]{11,21,31}, new int[]{41,51,61} ); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{11, 21, 31})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{41, 51, 61})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{11, 21, 31}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{41, 51, 61}); | |||
assertEquals(polygon.getDrawAreaHeight(), 1011); | |||
assertEquals(polygon.getDrawAreaWidth(), 1021); | |||
@@ -148,8 +150,8 @@ public class TestPolygon extends TestCase{ | |||
polygon = (HSSFPolygon) patriarch.getChildren().get(0); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{11, 21, 31})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{41, 51, 61})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{11, 21, 31}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{41, 51, 61}); | |||
assertEquals(polygon.getDrawAreaHeight(), 1011); | |||
assertEquals(polygon.getDrawAreaWidth(), 1021); | |||
} | |||
@@ -187,18 +189,18 @@ public class TestPolygon extends TestCase{ | |||
polygon1 = (HSSFPolygon) patriarch.getChildren().get(1); | |||
polygon2 = (HSSFPolygon) patriarch.getChildren().get(2); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{1, 2, 3})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{4,5,6})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{1, 2, 3}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{4,5,6}); | |||
assertEquals(polygon.getDrawAreaHeight(), 101); | |||
assertEquals(polygon.getDrawAreaWidth(), 102); | |||
assertTrue(Arrays.equals(polygon1.getXPoints(), new int[]{11,12,13})); | |||
assertTrue(Arrays.equals(polygon1.getYPoints(), new int[]{14,15,16})); | |||
assertArrayEquals(polygon1.getXPoints(), new int[]{11,12,13}); | |||
assertArrayEquals(polygon1.getYPoints(), new int[]{14,15,16}); | |||
assertEquals(polygon1.getDrawAreaHeight(), 104); | |||
assertEquals(polygon1.getDrawAreaWidth(), 103); | |||
assertTrue(Arrays.equals(polygon2.getXPoints(), new int[]{21,22,23})); | |||
assertTrue(Arrays.equals(polygon2.getYPoints(), new int[]{24,25,26})); | |||
assertArrayEquals(polygon2.getXPoints(), new int[]{21,22,23}); | |||
assertArrayEquals(polygon2.getYPoints(), new int[]{24,25,26}); | |||
assertEquals(polygon2.getDrawAreaHeight(), 204); | |||
assertEquals(polygon2.getDrawAreaWidth(), 203); | |||
} | |||
@@ -212,8 +214,8 @@ public class TestPolygon extends TestCase{ | |||
HSSFPolygon polygon = (HSSFPolygon) drawing.getChildren().get(0); | |||
assertEquals(polygon.getDrawAreaHeight(), 2466975); | |||
assertEquals(polygon.getDrawAreaWidth(), 3686175); | |||
assertTrue(Arrays.equals(polygon.getXPoints(), new int[]{0, 0, 31479, 16159, 19676, 20502})); | |||
assertTrue(Arrays.equals(polygon.getYPoints(), new int[]{0, 0, 36, 56, 34, 18})); | |||
assertArrayEquals(polygon.getXPoints(), new int[]{0, 0, 31479, 16159, 19676, 20502}); | |||
assertArrayEquals(polygon.getYPoints(), new int[]{0, 0, 36, 56, 34, 18}); | |||
} | |||
public void testPolygonType(){ |
@@ -17,15 +17,15 @@ | |||
package org.apache.poi.hssf.usermodel; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.hssf.HSSFTestDataSamples; | |||
import org.apache.poi.hssf.model.HSSFTestModelHelper; | |||
import org.apache.poi.hssf.model.TextboxShape; | |||
import org.apache.poi.hssf.record.ObjRecord; | |||
import org.apache.poi.hssf.record.TextObjectRecord; | |||
import java.util.Arrays; | |||
/** | |||
* @author Evgeniy Berlog | |||
* @date 25.06.12 | |||
@@ -47,25 +47,25 @@ public class TestText extends TestCase { | |||
byte[] actual = textbox.getEscherContainer().getChild(0).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
expected = textboxShape.getSpContainer().getChild(2).serialize(); | |||
actual = textbox.getEscherContainer().getChild(2).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
expected = textboxShape.getSpContainer().getChild(3).serialize(); | |||
actual = textbox.getEscherContainer().getChild(3).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
expected = textboxShape.getSpContainer().getChild(4).serialize(); | |||
actual = textbox.getEscherContainer().getChild(4).serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
ObjRecord obj = textbox.getObjRecord(); | |||
ObjRecord objShape = textboxShape.getObjRecord(); | |||
@@ -80,7 +80,7 @@ public class TestText extends TestCase { | |||
actual = torShape.serialize(); | |||
assertEquals(expected.length, actual.length); | |||
assertTrue(Arrays.equals(expected, actual)); | |||
assertArrayEquals(expected, actual); | |||
} | |||
public void testAddTextToExistingFile() { |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.ss.formula.ptg; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -77,7 +76,7 @@ public final class TestArrayPtg extends TestCase { | |||
if(outBuf[0] == 4) { | |||
throw new AssertionFailedError("Identified bug 42564b"); | |||
} | |||
assertTrue(Arrays.equals(ENCODED_CONSTANT_DATA, outBuf)); | |||
assertArrayEquals(ENCODED_CONSTANT_DATA, outBuf); | |||
} | |||
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.ss.formula.ptg; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import org.apache.poi.hssf.record.TestcaseRecordInputStream; | |||
@@ -45,6 +44,6 @@ public final class TestAttrPtg extends AbstractPtgTestCase { | |||
} catch (ArrayIndexOutOfBoundsException e) { | |||
throw new AssertionFailedError("incorrect re-serialization of tAttrChoose"); | |||
} | |||
assertTrue(Arrays.equals(data, data2)); | |||
assertArrayEquals(data, data2); | |||
} | |||
} |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.ss.formula.ptg; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -101,7 +100,7 @@ public final class TestReferencePtg extends TestCase { | |||
if (outData[0] == 0x24) { | |||
throw new AssertionFailedError("Identified bug 45091"); | |||
} | |||
assertTrue(Arrays.equals(tRefN_data, outData)); | |||
assertArrayEquals(tRefN_data, outData); | |||
} | |||
/** |
@@ -17,8 +17,7 @@ | |||
package org.apache.poi.ss.usermodel; | |||
import java.util.Arrays; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import junit.framework.TestCase; | |||
import org.apache.poi.ss.ITestDataProvider; | |||
@@ -179,7 +178,7 @@ public abstract class BaseTestSheetUpdateArrayFormulas extends TestCase { | |||
// remove the formula cells in C4:C6 | |||
CellRange<?> dcells = sheet.removeArrayFormula(cr.getTopLeftCell()); | |||
// removeArrayFormula should return the same cells as setArrayFormula | |||
assertTrue(Arrays.equals(cr.getFlattenedCells(), dcells.getFlattenedCells())); | |||
assertArrayEquals(cr.getFlattenedCells(), dcells.getFlattenedCells()); | |||
for(Cell acell : cr){ | |||
assertFalse(acell.isPartOfArrayFormulaGroup()); |
@@ -17,9 +17,10 @@ | |||
package org.apache.poi.util; | |||
import static org.junit.Assert.assertArrayEquals; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.Arrays; | |||
import junit.framework.AssertionFailedError; | |||
import junit.framework.TestCase; | |||
@@ -73,7 +74,7 @@ public final class TestLittleEndianStreams extends TestCase { | |||
} | |||
byte[] expBuf = HexRead.readFromString("77 66 55 44"); | |||
assertTrue(Arrays.equals(actBuf, expBuf)); | |||
assertArrayEquals(actBuf, expBuf); | |||
assertEquals(0x33, lei.readUByte()); | |||
assertEquals(0, lei.available()); | |||
} |