-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test artifact configuration on the user interface
Signed-off-by: Akashdeep Dhar <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from random import choice | ||
|
||
import pytest | ||
|
||
from gi_loadouts.data.arti import __artilist__ | ||
from gi_loadouts.face.util import truncate_text | ||
from gi_loadouts.type.arti import ArtiLevl, base | ||
from gi_loadouts.type.stat import STAT | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"name, rare, pair, quad, coll", | ||
[ | ||
pytest.param( | ||
name, team.rare, team.pairtext, team.quadtext, | ||
(team.fwol, team.pmod, team.sdoe, team.gboe, team.ccol), | ||
id=f"face.wind.rule: Configuration artifact - {name}" | ||
) for name, team in __artilist__.items() | ||
] | ||
) | ||
def test_arti(runner, name, rare, pair, quad, coll) -> None: | ||
""" | ||
Test the configuration of artifacts on the user interface | ||
:return: | ||
""" | ||
|
||
""" | ||
Set the user interface elements as intended | ||
""" | ||
conf = dict() | ||
|
||
for area in ["fwol", "pmod", "sdoe", "gboe", "ccol"]: | ||
conf[area] = dict() | ||
getattr(runner, f"arti_{area}_type").setCurrentText(name) | ||
conf[area]["rare"] = choice([item for item in rare]) | ||
getattr(runner, f"arti_{area}_rare").setCurrentText(conf[area]["rare"].value.name) | ||
conf[area]["levl"] = choice([item for item in ArtiLevl if conf[area]["rare"] in item.value.rare]) | ||
getattr(runner, f"arti_{area}_levl").setCurrentText(conf[area]["levl"].value.name) | ||
conf[area]["stat"] = choice([item for item in getattr(base, f"MainStatType_{area.upper()}") if item.value != STAT.none]) | ||
getattr(runner, f"arti_{area}_name_main").setCurrentText(conf[area]["stat"].value.value) | ||
|
||
""" | ||
Confirm if the user interface elements change accordingly | ||
""" | ||
if name == "None": | ||
return | ||
|
||
for indx, area in enumerate(["fwol", "pmod", "sdoe", "gboe", "ccol"]): | ||
item = coll[indx] | ||
assert getattr(runner, f"arti_{area}_type_name").text() == truncate_text(coll[indx].__name__, 32) | ||
item.rare, item.levl, item.stat_name = conf[area]["rare"].value.qant, conf[area]["levl"].value.levl, conf[area]["stat"] | ||
assert getattr(runner, f"arti_{area}_data_main").text() == str(round(item.stat_data, 1)) | ||
|
||
assert runner.pair_area_head.text() == f"<b>{truncate_text(name, 26)}</b> (2)" | ||
assert runner.quad_area_head.text() == f"<b>{truncate_text(name, 26)}</b> (4)" | ||
assert runner.pair_area_desc.toPlainText() == pair | ||
assert runner.quad_area_desc.toPlainText() == quad |