Skip to content

Commit cad0539

Browse files
committed
Add High DPI curve plot test for reproducing #10
1 parent a82cae5 commit cad0539

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Licensed under the terms of the BSD 3-Clause
4+
# (see plotpy/LICENSE for details)
5+
6+
"""Curve plotting test with high DPI"""
7+
8+
# guitest: show,skip
9+
10+
import os
11+
12+
import numpy as np
13+
import pytest
14+
from guidata.qthelpers import qt_app_context
15+
16+
from plotpy.builder import make
17+
from plotpy.tests import vistools as ptv
18+
19+
# Performance should be the same with "1" and "2" scale factors:
20+
# (as of today, this is not the case, but it has to be fixed in the future:
21+
# https://github.com/PlotPyStack/PlotPy/issues/10)
22+
os.environ["QT_SCALE_FACTOR"] = "2"
23+
24+
25+
@pytest.mark.skip(reason="This test is not relevant for the automated test suite")
26+
def test_plot_highdpi():
27+
"""Curve plotting test with high DPI"""
28+
x = np.linspace(-10, 10, 5000000) # 5M points are needed to see the difference
29+
y = np.sin(np.sin(np.sin(x)))
30+
with qt_app_context(exec_loop=True):
31+
_win = ptv.show_items(
32+
[make.curve(x, y, color="b"), make.legend("TR")],
33+
wintitle=test_plot_highdpi.__doc__,
34+
title="Curves with high DPI",
35+
plot_type="curve",
36+
)
37+
38+
39+
if __name__ == "__main__":
40+
test_plot_highdpi()

0 commit comments

Comments
 (0)