Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matsjoyce-refeyn committed Oct 29, 2024
1 parent 82264f0 commit 36a73eb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: MIT

import pathlib
import sys

import numpy as np
import pytest
Expand All @@ -19,6 +20,11 @@
FONT_PATH = pathlib.Path(__file__).parent / "fonts"
GENERATE_REFERENCE_IMAGES = False

# Getting the same results on different OSes is tricky, so essentially
# disable the comparisons when not on Windows (which is where the references were generated)
# TODO Improve this (have a reference set per OS?)
THRESHOLD = 0 if sys.platform == "win32" else 0.03

QML_IMPORT_NAME = "Tests"
QML_IMPORT_MAJOR_VERSION = 1

Expand All @@ -28,6 +34,10 @@ def qapp() -> QtGui.QGuiApplication:
QtQuick.QQuickWindow.setGraphicsApi(
QtQuick.QSGRendererInterface.GraphicsApi.Software
)
QtQuick.QQuickWindow.setSceneGraphBackend("software")
QtQuick.QQuickWindow.setTextRenderType(
QtQuick.QQuickWindow.TextRenderType.QtTextRendering
)

QtQuickControls2.QQuickStyle.setStyle("Basic")

Expand Down Expand Up @@ -141,9 +151,11 @@ def test_export(

else:
assert (
compare_images(grab_path, REFERENCE_PATH / grab_path.name, 800, 600) < 0.001
compare_images(grab_path, REFERENCE_PATH / grab_path.name, 800, 600)
<= THRESHOLD
)
assert (
compare_images(png_path, REFERENCE_PATH / png_path.name, 1600, 1200) < 0.001
compare_images(png_path, REFERENCE_PATH / png_path.name, 1600, 1200)
<= THRESHOLD
)
# TODO SVG and QPicture comparisons

0 comments on commit 36a73eb

Please sign in to comment.