Skip to content

Commit

Permalink
test images for 2022Server
Browse files Browse the repository at this point in the history
  • Loading branch information
emcek committed Dec 16, 2024
1 parent ade7bdd commit 8f47adf
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions tests/test_aircraft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from os import makedirs
from pathlib import Path
from platform import uname
from sys import platform
Expand Down Expand Up @@ -334,11 +333,10 @@ def test_prepare_image_for_all_planes(model, lcd, resources, img_precision, requ
set_bios_during_test(aircraft_model, bios_pairs)
img = aircraft_model.prepare_image()
ref_file_base_path = resources / platform / uname().release if platform == 'win32' else resources / platform
makedirs(name=ref_file_base_path, exist_ok=True)
if uname().release == '2022Server':
img.save(ref_file_base_path / f'{model}_{lcd}_{type(aircraft_model).__name__}.png')
else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_{lcd}_{type(aircraft_model).__name__}.png', precision=img_precision)
# if 'f4e' in model:
# img.save(ref_file_base_path / f'new_{model}_{lcd}_{type(aircraft_model).__name__}.png')
# else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_{lcd}_{type(aircraft_model).__name__}.png', precision=img_precision)


@mark.benchmark
Expand All @@ -364,11 +362,7 @@ def test_prepare_image_for_apache_wca_mode(model, resources, img_precision, requ
img = apache.prepare_image()
assert (Path(gettempdir()) / f'{type(apache).__name__}_999.png').exists()
ref_file_base_path = resources / platform / uname().release if platform == 'win32' else resources / platform
makedirs(name=ref_file_base_path, exist_ok=True)
if uname().release == '2022Server':
img.save(ref_file_base_path / f'{model}_wca_mode.png')
else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode.png', precision=img_precision)
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode.png', precision=img_precision)


# <=><=><=><=><=> Apache special <=><=><=><=><=>
Expand All @@ -392,11 +386,7 @@ def test_apache_wca_more_then_one_screen_scrolled(model, resources, img_precisio
assert apache.warning_line == 3
img = apache.prepare_image()
ref_file_base_path = resources / platform / uname().release if platform == 'win32' else resources / platform
makedirs(name=ref_file_base_path, exist_ok=True)
if uname().release == '2022Server':
img.save(ref_file_base_path / f'{model}_wca_mode_scroll_3.png')
else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode_scroll_3.png', precision=img_precision)
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode_scroll_3.png', precision=img_precision)

for i in range(1, 3):
apache.warning_line += 1
Expand All @@ -405,11 +395,7 @@ def test_apache_wca_more_then_one_screen_scrolled(model, resources, img_precisio
img = apache.prepare_image()
assert apache.warning_line == 1
ref_file_base_path = resources / platform / uname().release if platform == 'win32' else resources / platform
makedirs(name=ref_file_base_path, exist_ok=True)
if uname().release == '2022Server':
img.save(ref_file_base_path / f'{model}_wca_mode_scroll_1.png')
else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode_scroll_1.png', precision=img_precision)
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_wca_mode_scroll_1.png', precision=img_precision)


@mark.benchmark
Expand All @@ -419,8 +405,4 @@ def test_apache_pre_mode(model, apache_pre_mode_bios_data, resources, img_precis
set_bios_during_test(apache, apache_pre_mode_bios_data)
img = apache.prepare_image()
ref_file_base_path = resources / platform / uname().release if platform == 'win32' else resources / platform
makedirs(name=ref_file_base_path, exist_ok=True)
if uname().release == '2022Server':
img.save(ref_file_base_path / f'{model}_pre_mode.png')
else:
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_pre_mode.png', precision=img_precision)
assert compare_images(img=img, file_path=ref_file_base_path / f'{model}_pre_mode.png', precision=img_precision)

0 comments on commit 8f47adf

Please sign in to comment.