def test_plot_direct(self): w = Window() ult.plot(db) ofile = pjoin(output_dir,"test.ult.plot.direct.render.png") w.render(obase=ofile,res=[200,200]) self.assertTrue(os.path.isfile(ofile)) WindowManager.cleanup_windows() visit.DeleteAllPlots() visit.CloseDatabase(db)
def test_plot_direct(self): w = Window() ult.plot(db) obase = pjoin(output_dir, "test.ult.plot.direct.render") w.render(obase=obase, res=[200, 200]) self.assertTrue(os.path.isfile(obase + ".png")) WindowManager.cleanup_windows() visit.DeleteAllPlots() visit.CloseDatabase(db)
def test_bookkeeping(self): # note: this will only pass if you start with a single window # (use visit -noconfig) # create three windows and verify their ids w1 = Window() self.assertEqual(w1.window_id, 1) w2 = Window() self.assertEqual(w2.window_id, 2) w3 = Window() self.assertEqual(w3.window_id, 3) self.assertEqual(3, len(WindowManager.registered_windows())) # remove a window w2.remove() # make sure we have the proper # of windows self.assertEqual(2, len(WindowManager.registered_windows())) # make sure the window ids make sense rwins = WindowManager.registered_windows() rwids = [w.window_id for w in rwins] self.assertTrue(1 in rwids) self.assertTrue(3 in rwids) # create a new window, visit should give it the id '2' w4 = Window() self.assertEqual(w4.window_id, 2) w5 = Window() self.assertEqual(w5.window_id, 4) self.assertEqual(4, len(WindowManager.registered_windows())) w1.remove() w6 = Window() # create a new window, visit should give it the id '1' self.assertEqual(w6.window_id, 1) self.assertEqual(4, len(WindowManager.registered_windows())) w3.remove() w4.remove() w6.remove() self.assertEqual(1, len(WindowManager.registered_windows())) w5.remove() # new window id should be 4 w7 = Window() self.assertEqual(w7.window_id, 4) # make sure last id is set back to 1 wf = Window() w7.remove() self.assertEqual(wf.window_id, 1) wf.remove() self.assertEqual(0, len(WindowManager.registered_windows()))
def test_bookkeeping(self): # note: this will only pass if you start with a single window # (use visit -noconfig) # create three windows and verify their ids w1 = Window() self.assertEqual(w1.window_id,1) w2 = Window() self.assertEqual(w2.window_id,2) w3 = Window() self.assertEqual(w3.window_id,3) self.assertEqual(3,len(WindowManager.registered_windows())) # remove a window w2.remove() # make sure we have the proper # of windows self.assertEqual(2,len(WindowManager.registered_windows())) # make sure the window ids make sense rwins = WindowManager.registered_windows() rwids = [ w.window_id for w in rwins ] self.assertTrue(1 in rwids) self.assertTrue(3 in rwids) # create a new window, visit should give it the id '2' w4 = Window() self.assertEqual(w4.window_id,2) w5 = Window() self.assertEqual(w5.window_id,4) self.assertEqual(4,len(WindowManager.registered_windows())) w1.remove() w6 = Window() # create a new window, visit should give it the id '1' self.assertEqual(w6.window_id,1) self.assertEqual(4,len(WindowManager.registered_windows())) w3.remove() w4.remove() w6.remove() self.assertEqual(1,len(WindowManager.registered_windows())) w5.remove() # new window id should be 4 w7 = Window() self.assertEqual(w7.window_id,4) # make sure last id is set back to 1 wf = Window() w7.remove() self.assertEqual(wf.window_id,1) wf.remove() self.assertEqual(0,len(WindowManager.registered_windows()))
def cleanup_windows(self): WindowManager.cleanup_windows() visit.CloseDatabase(db) visit.CloseComputeEngine()
def cleanup_windows(self): for win in WindowManager.registered_windows(): win.remove() visit.CloseDatabase(db) visit.CloseComputeEngine()