Esempio n. 1
0
def show_game_details(app: QtWidgets.QApplication, options, game: Path):
    from randovania.layout.layout_description import LayoutDescription
    from randovania.gui.game_details.game_details_window import GameDetailsWindow

    layout = LayoutDescription.from_file(game)
    details_window = GameDetailsWindow(None, options)
    details_window.update_layout_description(layout)
    logger.info("Displaying game details")
    details_window.show()
    app.details_window = details_window
Esempio n. 2
0
def test_update_layout_description_actual_seed(skip_qtbot, test_files_dir):
    description = LayoutDescription.from_file(test_files_dir.joinpath("log_files", "seed_a.rdvgame"))

    # Run
    window = GameDetailsWindow(None, MagicMock())
    skip_qtbot.addWidget(window)
    window.update_layout_description(description)

    # Assert
    pickup_details_tab = window._game_details_tabs[0]
    assert isinstance(pickup_details_tab, PickupDetailsTab)
    assert len(pickup_details_tab.pickup_spoiler_buttons) == 119
    assert pickup_details_tab.pickup_spoiler_show_all_button.text() == "Show All"
    skip_qtbot.mouseClick(pickup_details_tab.pickup_spoiler_show_all_button, QtCore.Qt.LeftButton)
    assert pickup_details_tab.pickup_spoiler_show_all_button.text() == "Hide All"
Esempio n. 3
0
def test_update_layout_description_no_spoiler(skip_qtbot, mocker):
    # Setup
    mock_describer = mocker.patch("randovania.layout.preset_describer.describe", return_value=["a", "b", "c", "d"])
    mock_merge = mocker.patch("randovania.layout.preset_describer.merge_categories", return_value="<description>")

    options = MagicMock()
    description = MagicMock(spec=LayoutDescription)
    description.player_count = 1
    description.shareable_hash = "12345"
    description.shareable_word_hash = "Some Hash Words"
    description.randovania_version_text = "v1.2.4"
    description.permalink.as_base64_str = "<permalink>"
    description.generator_parameters = MagicMock(spec=GeneratorParameters)
    description.has_spoiler = False

    preset = description.get_preset.return_value
    preset.game.data.layout.get_ingame_hash.return_value = "<image>"
    preset.name = "CustomPreset"

    window = GameDetailsWindow(None, options)
    skip_qtbot.addWidget(window)

    # Run
    window.update_layout_description(description)

    # Assert
    mock_describer.assert_called_once_with(preset)
    mock_merge.assert_has_calls([
        call(["a", "c"]),
        call(["b", "d"]),
    ])
    assert window.layout_title_label.text() == ("""
        <p>
            Generated with Randovania v1.2.4<br />
            Seed Hash: Some Hash Words (12345)<br/>
            In-game Hash: <image><br/>
            Preset Name: CustomPreset
        </p>
        """)
Esempio n. 4
0
 def _open_game_details(self, layout: LayoutDescription):
     from randovania.gui.game_details.game_details_window import GameDetailsWindow
     details_window = GameDetailsWindow(self, self._options)
     details_window.update_layout_description(layout)
     details_window.show()
     self.track_window(details_window)