Skip to content

Commit

Permalink
Add High DPI curve plot test for reproducing #10
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed May 2, 2024
1 parent a82cae5 commit cad0539
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions plotpy/tests/items/test_curves_highdpi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the BSD 3-Clause
# (see plotpy/LICENSE for details)

"""Curve plotting test with high DPI"""

# guitest: show,skip

import os

import numpy as np
import pytest
from guidata.qthelpers import qt_app_context

from plotpy.builder import make
from plotpy.tests import vistools as ptv

# Performance should be the same with "1" and "2" scale factors:
# (as of today, this is not the case, but it has to be fixed in the future:
# https://github.com/PlotPyStack/PlotPy/issues/10)
os.environ["QT_SCALE_FACTOR"] = "2"


@pytest.mark.skip(reason="This test is not relevant for the automated test suite")
def test_plot_highdpi():
"""Curve plotting test with high DPI"""
x = np.linspace(-10, 10, 5000000) # 5M points are needed to see the difference
y = np.sin(np.sin(np.sin(x)))
with qt_app_context(exec_loop=True):
_win = ptv.show_items(
[make.curve(x, y, color="b"), make.legend("TR")],
wintitle=test_plot_highdpi.__doc__,
title="Curves with high DPI",
plot_type="curve",
)


if __name__ == "__main__":
test_plot_highdpi()

0 comments on commit cad0539

Please sign in to comment.