def test_HDRGenerator(self): self.HDRgen = CompositeImage.HDRGenerator() hdr_conf = CompositeImage.HDRConfig('/tmp', prefix='HDRTest') m = mock.MagicMock() with mock.patch('CompositeImage.subprocess.call', m): self.HDRgen(self.CI, hdr_conf) # self.assertTrue(self.CI.getFilelist.called, 'HDRgen did not call CI getFilelist') tif_list = [ os.path.splitext(os.path.basename(img))[0] + '.TIF' for img in self.short_fl ] cmds = [] cmds.append(['align_image_stack', '-atmp', '-p/tmp/HDRTest.pto'] + ['/tmp/TIF/%s' % t for t in tif_list]) cmds.append(['enfuse', '-o/tmp/HDRTest.TIF'] + ['tmp%04d.tif' % i for i, t in enumerate(tif_list)]) for i, method_call in enumerate(m.method_calls): expected = mock.call.call(cmds[i]).call_list() l = len(expected) self.assertEqual(l, 1, "len(expected)=%d, should be 1" % l) self.assertEqual( method_call, expected[0], "call args list:\n%s\nexpected:\n%s" % (method_call, expected))
def __init__(self, parent, id, title, rootdir): super(TreeCtrlFrame, self).__init__(parent, id, title, wx.DefaultPosition, wx.Size(450, 350)) panel = wx.Panel(self, -1) self.tree = TreeCtrlWithImages(panel, 1, wx.DefaultPosition, (-1,-1), wx.TR_HAS_BUTTONS) self.config_key = rootdir seq_config_dict[rootdir] = CompositeImage.HDRConfig('/tmp') RootItemExpander(self.tree, rootdir) self.updatebutton = wx.Button(self, id=wx.ID_REFRESH) self.updatebutton.Bind(wx.EVT_BUTTON, self.onUpdate) savebutton = wx.Button(self, id=wx.ID_SAVE) savebutton.Bind(wx.EVT_BUTTON, self.onSave) loadbutton = wx.Button(self, id=wx.ID_OPEN) loadbutton.Bind(wx.EVT_BUTTON, self.onLoad) self.stopbutton = wx.Button(self, id=wx.ID_STOP) self.stopbutton.Bind(wx.EVT_BUTTON, self.onStopCommand) self.stopbutton.Disable() button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add(self.updatebutton, 0, wx.EXPAND) button_sizer.Add(savebutton, 0, wx.EXPAND) button_sizer.Add(loadbutton, 0, wx.EXPAND) button_sizer.Add(self.stopbutton, 0, wx.EXPAND) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.tree, 1, wx.EXPAND) panel.SetSizer(sizer) vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(panel, 1, wx.EXPAND) vsizer.Add(button_sizer, 0, wx.EXPAND) self.SetSizer(vsizer) self.Layout() self.tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.onItemExpand, id=1) self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onRightClick, self.tree) self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onClickItem, self.tree) self.Bind(EVT_COMMAND_UPDATE, self.onCommandUpdate) self.Bind(wx.EVT_IDLE, self.OnIdle)
def test_SetGet(self): hdrc = CompositeImage.HDRConfig('/tmp') print dir(hdrc)
def _runSymlinkGen(self, tdir): symlinkgen = CompositeImage.SymlinkGenerator() hdr_config = CompositeImage.HDRConfig(tdir) symlinkgen(self.CI, hdr_config)