예제 #1
0
        public void BaseTestResize(IClientAnchor referenceAnchor)
        {
            IWorkbook       wb      = _testDataProvider.CreateWorkbook();
            ISheet          sh1     = wb.CreateSheet();
            IDrawing        p1      = sh1.CreateDrawingPatriarch();
            ICreationHelper factory = wb.GetCreationHelper();

            byte[]   pictureData = _testDataProvider.GetTestDataFileContent("logoKarmokar4.png");
            int      idx1        = wb.AddPicture(pictureData, PictureType.PNG);
            IPicture picture     = p1.CreatePicture(factory.CreateClientAnchor(), idx1);

            picture.Resize();
            IClientAnchor anchor1 = picture.GetPreferredSize();

            //assert against what would BiffViewer print if we insert the image in xls and dump the file
            Assert.AreEqual(referenceAnchor.Col1, anchor1.Col1);
            Assert.AreEqual(referenceAnchor.Row1, anchor1.Row1);
            Assert.AreEqual(referenceAnchor.Col2, anchor1.Col2);
            Assert.AreEqual(referenceAnchor.Row2, anchor1.Row2);
            Assert.AreEqual(referenceAnchor.Dx1, anchor1.Dx1);
            Assert.AreEqual(referenceAnchor.Dy1, anchor1.Dy1);
            Assert.AreEqual(referenceAnchor.Dx2, anchor1.Dx2);
            Assert.AreEqual(referenceAnchor.Dy2, anchor1.Dy2);
        }