File: test_stylesheet.py

package info (click to toggle)
python-qwt 0.12.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,376 kB
  • sloc: python: 11,953; makefile: 19; sh: 10
file content (37 lines) | stat: -rw-r--r-- 950 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-

SHOW = True  # Show test in GUI-based test launcher

import os

import numpy as np
import pytest
import qtpy
from qtpy.QtCore import Qt

import qwt
from qwt.tests import utils


class StyleSheetPlot(qwt.QwtPlot):
    def __init__(self):
        super().__init__()
        self.setTitle("Stylesheet test (Issue #63)")
        self.setStyleSheet("background-color: #19232D; color: #E0E1E3;")
        qwt.QwtPlotGrid.make(self, color=Qt.white, width=0, style=Qt.DotLine)
        x = np.arange(-5.0, 5.0, 0.1)
        qwt.QwtPlotCurve.make(x, np.sinc(x), "y = sinc(x)", self, linecolor="green")


# Skip the test for PySide6 on Linux
@pytest.mark.skipif(
    qtpy.API_NAME == "PySide6" and os.name == "posix",
    reason="Fails on Linux with PySide6 for unknown reasons",
)
def test_stylesheet():
    """Stylesheet test"""
    utils.test_widget(StyleSheetPlot, size=(600, 400))


if __name__ == "__main__":
    test_stylesheet()