def test_sortButtonWorks(self): sys.argv[1:] = [test_filename] gsac, opts = getDataOpts() axs = getAxes(opts) ppmm = PickPhaseMenuMore(gsac, opts, axs) # get files before sorting unsortedFiles = [] for sacdh in gsac.selist: unsortedFiles.append(sacdh.filename) # click the sort button event_clickSortBtn = matplotlib.backend_bases.MouseEvent('button_press_event', ppmm.axstk.figure.canvas, 62, 295) ppmm.sorting(event_clickSortBtn) # click sort filename button event_clickSortFilenameBtn = matplotlib.backend_bases.MouseEvent('button_press_event', ppmm.figsort.canvas, 151, 700) ppmm.sort_file(event_clickSortFilenameBtn) # get files after sorting sortedFiles = [] for sacdh in gsac.selist: sortedFiles.append(sacdh.filename) self.assertNotEqual(unsortedFiles, sortedFiles)
def test_sortButtonWorks(self): sys.argv[1:] = [test_filename] gsac, opts = getDataOpts() axs = getAxes(opts) ppmm = PickPhaseMenuMore(gsac, opts, axs) # get files before sorting unsortedFiles = [] for sacdh in gsac.selist: unsortedFiles.append(sacdh.filename) # click the sort button event_clickSortBtn = matplotlib.backend_bases.MouseEvent( 'button_press_event', ppmm.axstk.figure.canvas, 62, 295) ppmm.sorting(event_clickSortBtn) # click sort filename button event_clickSortFilenameBtn = matplotlib.backend_bases.MouseEvent( 'button_press_event', ppmm.figsort.canvas, 151, 700) ppmm.sort_file(event_clickSortFilenameBtn) # get files after sorting sortedFiles = [] for sacdh in gsac.selist: sortedFiles.append(sacdh.filename) self.assertNotEqual(unsortedFiles, sortedFiles)
def test_sortFigExists(self): sys.argv[1:] = [test_filename] gsac, opts = getDataOpts() axs = getAxes(opts) ppmm = PickPhaseMenuMore(gsac, opts, axs) self.assertFalse(hasattr(ppmm,'figsort')) fake_event = matplotlib.backend_bases.MouseEvent('button_press_event', ppmm.axstk.figure.canvas, 62, 295) ppmm.sorting(fake_event) self.assertIsNotNone(ppmm.figsort) self.assertIsNotNone(ppmm.sortAxs)
def test_sortFigExists(self): sys.argv[1:] = [test_filename] gsac, opts = getDataOpts() axs = getAxes(opts) ppmm = PickPhaseMenuMore(gsac, opts, axs) self.assertFalse(hasattr(ppmm, 'figsort')) fake_event = matplotlib.backend_bases.MouseEvent( 'button_press_event', ppmm.axstk.figure.canvas, 62, 295) ppmm.sorting(fake_event) self.assertIsNotNone(ppmm.figsort) self.assertIsNotNone(ppmm.sortAxs)