FileDocCategorySizeDatePackage
TestSheet.javaAPI DocApache Poi 3.0.13828Thu May 31 18:45:58 BST 2007org.apache.poi.hslf.model

TestSheet

public class TestSheet extends TestCase
Test common functionality of the Sheet object. For each ppt in the test directory check that all sheets are properly initialized
author
Yegor Kozlov

Fields Summary
Constructors Summary
Methods Summary
private voiddoSlideShow(org.apache.poi.hslf.usermodel.SlideShow ppt)

        Slide[] slide = ppt.getSlides();
        for (int i = 0; i < slide.length; i++) {
            verify(slide[i]);

            Notes notes = slide[i].getNotesSheet();
            if(notes != null) verify(notes);

            MasterSheet master = slide[i].getMasterSheet();
            assertNotNull(master);
            verify(master);
        }
    
public voidtestSheet()
For each ppt in the test directory check that all sheets are properly initialized

        File home = new File(System.getProperty("HSLF.testdata.path"));
        File[] files = home.listFiles();
        for (int i = 0; i < files.length; i++) {
            if(!files[i].getName().endsWith(".ppt")) continue;
            try {
                FileInputStream is = new FileInputStream(files[i]);
                HSLFSlideShow hslf = new HSLFSlideShow(is);
                is.close();

                SlideShow ppt = new SlideShow(hslf);
                doSlideShow(ppt);
            } catch (EncryptedPowerPointFileException e){
                ; //skip encrypted ppt
            }
        }
    
private voidverify(org.apache.poi.hslf.model.Sheet sheet)

        assertNotNull(sheet.getSlideShow());

        ColorSchemeAtom colorscheme = sheet.getColorScheme();
        assertNotNull(colorscheme);

        PPDrawing ppdrawing = sheet.getPPDrawing();
        assertNotNull(ppdrawing);

        Background background = sheet.getBackground();
        assertNotNull(background);

        assertTrue(sheet._getSheetNumber() != 0);
        assertTrue(sheet._getSheetRefId() != 0);

        TextRun[] txt = sheet.getTextRuns();
        assertTrue(txt != null);
        for (int i = 0; i < txt.length; i++) {
            assertNotNull(txt[i].getSheet());
        }

        Shape[] shape = sheet.getShapes();
        assertTrue(shape != null);
        for (int i = 0; i < shape.length; i++) {
            assertNotNull(shape[i].getSpContainer());
            assertNotNull(shape[i].getSheet());
            assertNotNull(shape[i].getShapeName());
            assertNotNull(shape[i].getAnchor());
        }