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"));
 }
Exemple #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());
        }
 public void TestGetTileBadAdress()
 {
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(0, new SizeL(-1, 0)));
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(0, new SizeL(1, 0)));
 }
 public void TestGetTileBadLevel()
 {
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(-1, new SizeL(0, 0)));
     MyAssert.Throws <ArgumentException>(() => dz.GetTile(10, new SizeL(0, 0)));
 }
Exemple #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"));
 }
Exemple #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)));
 }
Exemple #7
0
 public void TestReadRegionBadSize()
 {
     MyAssert.Throws <OpenSlideException>(() => osr.ReadRegion(new SizeL(0, 0), 1, new SizeL(400, -5)));
 }
Exemple #8
0
 public void TestReadRegionSizeDimensionZero()
 {
     MyAssert.Throws <ArgumentException>(() => osr.ReadRegion(new SizeL(0, 0), 0, new SizeL(400, 0)));
 }
Exemple #9
0
 public void TestReadRegionBadLevel()
 {
     MyAssert.Throws <OpenSlideException>(() => osr.ReadRegion(new SizeL(0, 0), 1, new SizeL(100, 100)));
 }
Exemple #10
0
 public void TestOpen()
 {
     MyAssert.Throws <IOException>(() => new ImageSlide("does_not_exist"));
     MyAssert.Throws <IOException>(() => new ImageSlide("setup.py"));
 }