예제 #1
0
def test_signals_project_creation_with_project_type_when_new_project_button_clicked(
        driver):
    new_project_signal = ValueMatcherProbe("new project", "mp3")
    _ = show_page(on_create_project=new_project_signal.received)

    driver.new_project()
    driver.check(new_project_signal)
예제 #2
0
def test_signals_when_about_menu_item_clicked(driver):
    about_signal = ValueMatcherProbe("about")

    _ = show_main_window(on_about=lambda pressed: about_signal.received())

    driver.about()
    driver.check(about_signal)
예제 #3
0
def test_signals_project_load_when_load_project_button_clicked(driver):
    load_project_signal = ValueMatcherProbe("load project", "project.tgit")
    _ = show_page(select_project=lambda on_select: on_select("project.tgit"),
                  on_load_project=load_project_signal.received)

    driver.load()
    driver.check(load_project_signal)
예제 #4
0
def test_signals_when_sign_in_menu_item_clicked(driver):
    sign_in_signal = ValueMatcherProbe("sign in")

    _ = show_main_window(on_sign_in=sign_in_signal.received)

    driver.sign_in()
    driver.check(sign_in_signal)
예제 #5
0
def test_signals_when_settings_menu_item_clicked(driver):
    window_ = show_main_window()
    change_settings_signal = ValueMatcherProbe("change settings")
    window_.on_settings(lambda checked: change_settings_signal.received())

    driver.settings()
    driver.check(change_settings_signal)
def test_signals_when_artwork_selected(driver):
    album = make_album()
    signal = ValueMatcherProbe("select artwork")
    _ = show_page(album, on_select_artwork=lambda: signal.received())

    driver.add_artwork()
    driver.check(signal)
예제 #7
0
def test_asks_for_confirmation_when_project_file_already_exists(driver):
    project_exists_query = ValueMatcherProbe("check project exists",
                                             ("Honeycomb", "Documents"))
    _ = show_page(
        project_exists=lambda *args: project_exists_query.received(args))

    driver.create_project("Honeycomb", "Documents")
    driver.check(project_exists_query)
예제 #8
0
def test_signals_when_online_help_menu_item_clicked(driver):
    online_help_signal = ValueMatcherProbe("online help",
                                           "http://blog.tagyourmusic.com/en")

    _ = show_main_window(on_online_help=online_help_signal.received)

    driver.help()
    driver.check(online_help_signal)
예제 #9
0
def test_signals_when_register_menu_item_clicked(driver):
    register_signal = ValueMatcherProbe("register",
                                        "https://tagyourmusic.com/en")

    _ = show_main_window(on_register=register_signal.received)

    driver.register()
    driver.check(register_signal)
예제 #10
0
def test_signals_when_project_selected(driver):
    project_selected_signal = ValueMatcherProbe("project file selected",
                                                resources.path("album.tgit"))
    _ = show_dialog(on_select=lambda dest: project_selected_signal.received(
        os.path.abspath(dest)))

    driver.load(resources.path("album.tgit"))
    driver.check(project_selected_signal)
예제 #11
0
def test_signals_when_sign_out_menu_item_clicked(driver):
    sign_out_signal = ValueMatcherProbe("sign out")

    window_ = show_main_window(on_sign_out=sign_out_signal.received)
    window_.user_signed_in(User(email="*****@*****.**"))

    driver.sign_out()
    driver.check(sign_out_signal)
예제 #12
0
def test_signals_project_to_open_when_open_action_triggered(driver, using):
    signal = ValueMatcherProbe("open project", "project.tgit")

    _ = show_page(make_project_history(
        make_snapshot(name="project", path="project.tgit")),
                  on_load_project=signal.received)

    driver.open_recent_project(starts_with("project"), using=using)
    driver.check(signal)
예제 #13
0
def test_makes_play_track_request_when_play_context_menu_item_selected(driver):
    page = show_track_list_tab(
        make_album(type="mp3", tracks=[make_track(track_title="Spain")]))

    play_request = ValueMatcherProbe("play track request", has_title("Spain"))
    page.on_play_track(play_request.received)

    driver.play_track("Spain")
    driver.check(play_request)
def test_signals_selected_file(driver):
    mp3 = resources.path("audio", "Rolling in the Deep.mp3")
    track_selection_signal = ValueMatcherProbe("track selection", mp3)

    _ = show_dialog(on_select_file=lambda sel: track_selection_signal.received(
        os.path.abspath(sel)))

    driver.select_tracks(mp3)
    driver.check(track_selection_signal)
예제 #15
0
def test_signals_close_event_on_close(driver):
    closed_signal = ValueMatcherProbe("closed signal")

    widget = CloseableWidget()
    widget.closed.connect(closed_signal.received)

    widget.close()

    driver.check(closed_signal)
예제 #16
0
def test_signals_project_creation_cancellation(driver, using_shortcut):
    cancel_creation_signal = ValueMatcherProbe("cancel creation")
    page = show_page()
    page.on_cancel_creation(lambda: cancel_creation_signal.received())

    driver.cancel_creation("Honeycomb",
                           "Documents",
                           using_shortcut=using_shortcut)
    driver.check(cancel_creation_signal)
예제 #17
0
def test_signals_save_as_destination(tmpdir, driver):
    destination = tmpdir.join("album.csv").strpath
    save_as_signal = ValueMatcherProbe("save as", destination)

    _ = show_dialog(
        on_select=lambda dest: save_as_signal.received(os.path.abspath(dest)))

    driver.save_as(destination)
    driver.check(save_as_signal)
예제 #18
0
def test_signals_when_save_project_keyboard_shortcut_is_activated(driver):
    projet = make_album()
    signal = ValueMatcherProbe("save", projet)

    window_ = show_main_window(on_save_project=signal.received)
    window_.display_project_screen(projet)

    driver.save(using_shortcut=True)
    driver.check(signal)
예제 #19
0
def test_signals_when_request_feature_menu_item_clicked(driver):
    request_feature_signal = ValueMatcherProbe(
        "request feature",
        "mailto:[email protected]?subject=[TGiT] I want more!")

    _ = show_main_window(on_request_feature=request_feature_signal.received)

    driver.request_feature()
    driver.check(request_feature_signal)
예제 #20
0
def test_signals_when_save_project_menu_item_clicked(driver):
    projet = make_album()
    signal = ValueMatcherProbe("save", projet)

    window_ = show_main_window(on_save_project=signal.received)
    window_.display_project_screen(projet)

    driver.save()
    driver.check(signal)
def test_selects_identities_on_isni_lookup(driver):
    signal = ValueMatcherProbe("select identity", "performer")

    _ = show_page(make_album(lead_performer="performer"),
                  make_registered_session(),
                  on_select_identity=signal.received)

    driver.lookup_isni_of_main_artist()
    driver.check(signal)
예제 #22
0
def test_signals_when_preferences_edited(driver):
    language_changed_signal = ValueMatcherProbe("settings",
                                                has_entry("locale", "fr"))

    _ = show_preferences_dialog(
        on_preferences_changed=language_changed_signal.received)

    driver.select_language("Français")
    driver.click_ok()
    driver.check(language_changed_signal)
예제 #23
0
def test_signals_when_project_closed(driver):
    project = make_album()
    signal = ValueMatcherProbe("close", project)

    window_ = show_main_window(confirm_close=lambda on_accept: on_accept(),
                               on_close_project=signal.received)
    window_.display_project_screen(project)

    driver.close_project()
    driver.check(signal)
예제 #24
0
def test_makes_stop_track_request_when_stop_context_menu_item_selected(driver):
    spain = make_track(track_title="Spain")
    stop_request = ValueMatcherProbe("stop track request")

    page = show_track_list_tab(make_album(type="mp3", tracks=[spain]))
    page.on_stop_track(stop_request.received)

    page.playback_started(spain)
    driver.stop_track("Spain")
    driver.check(stop_request)
예제 #25
0
def test_signals_select_album_destination(tmpdir, driver):
    destination = tmpdir.strpath
    select_album_destination_signal = ValueMatcherProbe(
        "select destination", equal_to(destination))

    _ = show_dialog(on_select=lambda dest: select_album_destination_signal.
                    received(os.path.abspath(dest)))

    driver.select_destination(destination)
    driver.check(select_album_destination_signal)
예제 #26
0
def test_creates_project_if_confirmed(driver):
    create_project_signal = ValueMatcherProbe(
        "new project", ("flac", "Honeycomb", "Documents", "track.flac"))
    _ = show_page(
        of_type="flac",
        project_exists=yes,
        on_create_project=lambda *args: create_project_signal.received(args))

    driver.create_project("Honeycomb", "Documents", "track.flac")
    driver.check(create_project_signal)
예제 #27
0
def test_adds_extension_when_none_was_specified(tmpdir, driver):
    destination = tmpdir.join("album").strpath
    save_as_signal = ValueMatcherProbe("save as", destination + ".csv")

    _ = show_dialog(
        on_select=lambda dest: save_as_signal.received(os.path.abspath(dest)),
        default_suffix="csv")

    driver.save_as(destination)
    driver.check(save_as_signal)
def test_restricts_selection_based_on_file_type(driver):
    flac_file = resources.path("audio", "Zumbar.flac")
    tracks_selection_signal = ValueMatcherProbe("track(s) selection",
                                                contains(flac_file))

    _ = show_dialog("flac",
                    on_select_files=lambda *sel: tracks_selection_signal.
                    received(_abs_path(sel)))

    driver.select_tracks(flac_file)
    driver.check(tracks_selection_signal)
예제 #29
0
def test_warn_user_if_save_fails(driver):
    save_failed_signal = ValueMatcherProbe("save project failed",
                                           instance_of(OSError))
    project = make_album()

    window_ = show_main_window(on_save_project=_raise_os_error("Save failed"),
                               show_save_error=save_failed_signal.received)
    window_.display_project_screen(project)

    driver.save()
    driver.check(save_failed_signal)
예제 #30
0
def test_asks_for_confirmation_before_closing_project(driver):
    project = make_album()
    confirm_close_query = ValueMatcherProbe("confirm close")

    window_ = show_main_window(
        confirm_close=lambda **_: confirm_close_query.received(),
        on_close_project=ignore)
    window_.display_project_screen(project)

    driver.close_project()
    driver.check(confirm_close_query)