Example #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("")
Example #2
0
def test_widget_channels_reref(qtbot):
    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))

    w.channels.new_group(test_name='reref')

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)
    channelsgroup.idx_l0.item(0).setSelected(True)
    channelsgroup.idx_l0.item(1).setSelected(True)
    channelsgroup.idx_reref.click()
    w.channels.button_apply.click()

    w.channels.save_channels(test_name=str(channel_montage_reref_file))

    # add one channel that doesn't exist
    with channel_montage_file.open() as outfile:
        groups = load(outfile)
    groups[0]['chan_to_plot'].append('NOT EXIST')
    with channel_montage_file.open('w') as outfile:
        dump(groups, outfile, indent=' ')

    # load dataset, but ignore extra channel
    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    w.channels.load_channels(test_name=str(channel_montage_file))

    assert 'NOT EXIST' in w.statusBar().currentMessage()
Example #3
0
def test_widget_notes_import_error(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.notes.import_fasst(test_fasst=str(gui_file),
                         test_annot=str(annot_fasst_export_file))
    assert 'FASST .mat file' in w.statusBar().currentMessage()