예제 #1
0
 public void TestGetDziMetadataString()
 {
     Assert.IsTrue(dz.GetDziMetadataString("jpeg").Contains("http://schemas.microsoft.com/deepzoom/2008"));
     Assert.IsTrue(dz.GetDziMetadataString("JPEG").Contains("jpeg"));
     Assert.IsTrue(dz.GetDziMetadataString("jpeg").Contains("254"));
     Assert.IsTrue(dz.GetDziMetadataString("jpeg").Contains("1"));
     Assert.IsTrue(dz.GetDziMetadataString("PNG").Contains("png"));
     MyAssert.Throws <ArgumentException>(() => dz.GetDziMetadataString("gif"));
     MyAssert.Throws <ArgumentException>(() => dz.GetDziMetadataString("gif"));
 }
예제 #2
0
        public void TestOperationsOnClosedHandle()
        {
            var img = Image.FromFile("tests/boxes.png");
            var osr = new ImageSlide(img);

            osr.Close();
            MyAssert.Throws <Exception>(() => osr.ReadRegion(new SizeL(0, 0), 0, new SizeL(100, 100)));
            //# If an Image is passed to the constructor, ImageSlide.close() shouldn't close it
            var bitmap = img as Bitmap;

            Assert.AreEqual(Color.White.ToArgb(), bitmap.GetPixel(0, 0).ToArgb());
        }
예제 #3
0
 public void TestGetTileBadAdress()
 {
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(0, new SizeL(-1, 0)));
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(0, new SizeL(1, 0)));
 }
예제 #4
0
 public void TestGetTileBadLevel()
 {
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(-1, new SizeL(0, 0)));
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(10, new SizeL(0, 0)));
 }
예제 #5
0
 public void TestOpen()
 {
     MyAssert.Throws <OpenSlideException>(() => new OpenSlide("does_not_exist"));
     MyAssert.Throws <OpenSlideException>(() => new OpenSlide("setup.py"));
     MyAssert.Throws <OpenSlideException>(() => new OpenSlide("tests/unopenable.tiff"));
 }
예제 #6
0
 public void TestReadBadRegion()
 {
     Assert.AreEqual(osr.Properties["openslide.vendor"], "aperio");
     MyAssert.Throws <OpenSlideException>(() => osr.ReadRegion(new SizeL(0, 0), 0, new SizeL(16, 16)));
 }
예제 #7
0
 public void TestReadRegionBadSize()
 {
     MyAssert.Throws <OpenSlideException>(() => osr.ReadRegion(new SizeL(0, 0), 1, new SizeL(400, -5)));
 }
예제 #8
0
 public void TestReadRegionSizeDimensionZero()
 {
     MyAssert.Throws <ArgumentException>(() => osr.ReadRegion(new SizeL(0, 0), 0, new SizeL(400, 0)));
 }
예제 #9
0
 public void TestReadRegionBadLevel()
 {
     MyAssert.Throws <OpenSlideException>(() => osr.ReadRegion(new SizeL(0, 0), 1, new SizeL(100, 100)));
 }
예제 #10
0
 public void TestOpen()
 {
     MyAssert.Throws <IOException>(() => new ImageSlide("does_not_exist"));
     MyAssert.Throws <IOException>(() => new ImageSlide("setup.py"));
 }