mirror of
https://github.com/pyapp-kit/superqt.git
synced 2026-01-04 19:31:24 +01:00
* fix: fix fonticon * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix entry points API Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
29 lines
723 B
Python
29 lines
723 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from qtpy.QtGui import QIcon, QPixmap
|
|
|
|
from superqt.fonticon import _plugins, icon
|
|
from superqt.fonticon._qfont_icon import QFontIconStore
|
|
|
|
FIXTURES = Path(__file__).parent / "fixtures"
|
|
|
|
|
|
@pytest.fixture
|
|
def plugin_store(qapp, monkeypatch):
|
|
_path = [str(FIXTURES)] + sys.path.copy()
|
|
store = QFontIconStore().instance()
|
|
with monkeypatch.context() as m:
|
|
m.setattr(sys, "path", _path)
|
|
yield store
|
|
store.clear()
|
|
|
|
|
|
def test_plugin(plugin_store):
|
|
assert not _plugins.loaded()
|
|
icn = icon("ico.smiley")
|
|
assert _plugins.loaded() == {"ico": ["smiley"]}
|
|
assert isinstance(icn, QIcon)
|
|
assert isinstance(icn.pixmap(40, 40), QPixmap)
|