diff options
author | Jay Kamat <jaygkamat@gmail.com> | 2019-05-15 18:49:18 -0700 |
---|---|---|
committer | Jay Kamat <jaygkamat@gmail.com> | 2019-05-16 20:05:09 -0700 |
commit | 2dd8966fdcf11972062c540b7a787e4d0de8d372 (patch) | |
tree | 8e302e4d6c94c4eda5391c67296c4ec5e66501a5 /tests/unit/utils/test_qtutils.py | |
parent | 6c653125d95a26db53471dba1bc331aee3b0477e (diff) | |
download | qutebrowser-2dd8966fdcf11972062c540b7a787e4d0de8d372.tar.gz qutebrowser-2dd8966fdcf11972062c540b7a787e4d0de8d372.zip |
Fix tab and webkit background colors clearing on config change
Per the qt docs, we should not call setPalette on a class that also
uses stylesheets. Since #4637, we set a stylesheet on the application,
so we cannot use setPalette anymore. This commit refactors those calls
to use stylesheets instead.
As far as I can tell, QPalette is OK to use when manually drawing (we
currently use it there).
Diffstat (limited to 'tests/unit/utils/test_qtutils.py')
-rw-r--r-- | tests/unit/utils/test_qtutils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/utils/test_qtutils.py b/tests/unit/utils/test_qtutils.py index e30200bbc..2e108210b 100644 --- a/tests/unit/utils/test_qtutils.py +++ b/tests/unit/utils/test_qtutils.py @@ -29,6 +29,7 @@ import unittest.mock import pytest from PyQt5.QtCore import (QDataStream, QPoint, QUrl, QByteArray, QIODevice, QTimer, QBuffer, QFile, QProcess, QFileDevice) +from PyQt5.QtGui import QColor from qutebrowser.utils import qtutils, utils import overflow_test_cases @@ -223,6 +224,15 @@ def test_qdatastream_status_count(): assert len(status_vals) == 4 +@pytest.mark.parametrize('color, expected', [ + (QColor('red'), 'rgba(255, 0, 0, 255)'), + (QColor('blue'), 'rgba(0, 0, 255, 255)'), + (QColor(1, 3, 5, 7), 'rgba(1, 3, 5, 7)'), +]) +def test_qcolor_to_qsscolor(color, expected): + assert qtutils.qcolor_to_qsscolor(color) == expected + + @pytest.mark.parametrize('obj', [ QPoint(23, 42), QUrl('http://www.qutebrowser.org/'), |