Exemplo n.º 1
0
 def test_do_first(self):
     """First step."""
     m = IIIFManipulatorNetpbm()
     # no image
     self.assertRaises(IIIFError, m.do_first)
     # add image, get size
     m.srcfile = 'testimages/test1.png'
     self.assertEqual(m.do_first(), None)
     self.assertEqual(m.width, 175)
     self.assertEqual(m.height, 131)
Exemplo n.º 2
0
 def test_do_first(self):
     """First step."""
     m = IIIFManipulatorNetpbm()
     # no image
     self.assertRaises(IIIFError, m.do_first)
     # add image, get size
     m.srcfile = 'testimages/test1.png'
     self.assertEqual(m.do_first(), None)
     self.assertEqual(m.width, 175)
     self.assertEqual(m.height, 131)
Exemplo n.º 3
0
            # specific to image
            i = IIIFInfo()
            i.identifier = self.iiif.identifier
            i.width = manipulator.width
            i.height = manipulator.height
            import io
            return(io.StringIO(i.as_json()), "application/json")
        else:
            (outfile, mime_type) = manipulator.derive(file, iiif)
            return(open(outfile, 'r'), mime_type)

myname = (os.environ['SCRIPT_NAME'] if (
    'SCRIPT_NAME' in os.environ) else '/iiif_dummy.cgi')

if (re.match(myname, '/iiif_dummy') is not None):
    from iiif.manipulator_dummy import IIIFManipulatorDummy
    IIIFRequestHandler.manipulator_class = IIIFManipulatorDummy
elif (re.match(myname, '/iiif_netpbm') is not None):
    from iiif.manipulator_netpbm import IIIFManipulatorNetpbm
    IIIFManipulatorNetpbm.find_binaries(tmpdir=TMP_DIR,
                                        shellsetup=SHELL_SETUP,
                                        pnmdir=PNM_DIR)
    IIIFRequestHandler.manipulator_class = IIIFManipulatorNetpbm
else:
    # Assume PIL requested (normal path '/iiif_pil'
    from iiif.manipulator_pil import IIIFManipulatorPIL
    IIIFRequestHandler.manipulator_class = IIIFManipulatorPIL

rh = IIIFRequestHandler()
rh.do_GET()
Exemplo n.º 4
0
 def test01_init(self):
     """Initialize."""
     m = IIIFManipulatorNetpbm()
     self.assertTrue(m.api_version)
Exemplo n.º 5
0
 def test_do_first_empty(self):
     """First step with no image."""
     m = IIIFManipulatorNetpbm()
     # no image
     self.assertRaises(IIIFError, m.do_first)
Exemplo n.º 6
0
 def test01_init(self):
     m = IIIFManipulatorNetpbm()
     self.assertEqual(m.api_version, '2.0')