def test_variant_override(monkeypatch, caplog, value, is_valid, expected):
    versions = version.WebEngineVersions.from_pyqt('5.15.0')
    monkeypatch.setenv('QUTE_DARKMODE_VARIANT', value)

    with caplog.at_level(logging.WARNING):
        assert darkmode._variant(versions) == expected

    log_msg = 'Ignoring invalid QUTE_DARKMODE_VARIANT=invalid_value'
    assert (log_msg in caplog.messages) != is_valid
def test_variant_override(monkeypatch, caplog, value, is_valid, expected):
    monkeypatch.setattr(darkmode.qtutils, 'qVersion', lambda: None)
    monkeypatch.setattr(darkmode, 'PYQT_WEBENGINE_VERSION', 0x050f00)
    monkeypatch.setenv('QUTE_DARKMODE_VARIANT', value)

    with caplog.at_level(logging.WARNING):
        assert darkmode._variant() == expected

    log_msg = 'Ignoring invalid QUTE_DARKMODE_VARIANT=invalid_value'
    assert (log_msg in caplog.messages) != is_valid
Beispiel #3
0
def test_variant(monkeypatch, qversion, webengine_version, expected):
    monkeypatch.setattr(darkmode.qtutils, 'qVersion', lambda: qversion)
    monkeypatch.setattr(darkmode, 'PYQT_WEBENGINE_VERSION', webengine_version)
    assert darkmode._variant() == expected
Beispiel #4
0
def test_variant_gentoo_workaround(gentoo_version_patch):
    assert darkmode._variant() == darkmode.Variant.qt_515_3
Beispiel #5
0
def test_variant(monkeypatch, webengine_version, expected):
    versions = version.WebEngineVersions.from_pyqt(webengine_version)
    monkeypatch.setattr(version, 'qtwebengine_versions', lambda avoid_init: versions)
    assert darkmode._variant() == expected
def test_variant(webengine_version, expected):
    versions = version.WebEngineVersions.from_pyqt(webengine_version)
    assert darkmode._variant(versions) == expected