Exemple #1
0
def test_widget_traces_gotoepoch(qtbot):

    w = MainWindow()
    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()

    act_navigation = find_in_qt(menubar, QAction, 'Navigation')
    menubar.setActiveAction(act_navigation)
    act_navigation.menu().setActiveAction(w.traces.action['go_to_epoch'])

    screenshot(w, 'traces_01_gotoepoch.png')
    w.close()

    w.traces.go_to_epoch(test_text_str='xxx')
    assert w.statusBar().currentMessage() == 'Input can only contain digits and colons'

    w.traces.go_to_epoch(test_text_str='1130')
    assert w.value('window_start') == 1130

    w.traces.go_to_epoch(test_text_str='22:30')
    assert w.value('window_start') == 20400

    w.info.idx_start.setStyleSheet("background-color: red;")
    w.info.grab().save(str(GUI_PATH / 'traces_02_gotoepoch.png'))
    w.info.idx_start.setStyleSheet("")
Exemple #2
0
def test_widget_exportsvg(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()
    act_view = find_in_qt(menubar, QAction, 'View')
    menubar.setActiveAction(act_view)
    act_view.menu().setActiveAction(w.traces.action['export_svg'])

    screenshot(w, 'exportsvg_01.png')

    export_graphics(w, test=str(svg_file))  # without extension
    assert svg_file.with_suffix('.svg').exists()
    w.close()

    svg_d = SVGDialog(str(svg_file))
    svg_d.button_clicked(svg_d.idx_ok)
    svg_d.button_clicked(svg_d.idx_cancel)
    svg_d.grab().save(str(GUI_PATH / 'exportsvg_02.png'))