Skip to content

Commit

Permalink
fix test for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwadhwa committed Nov 23, 2022
1 parent 02a0d03 commit 8e8723b
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions tests/test_collapsible.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
"""A test module for testing collapsible"""
from pathlib import Path

import pytest
from fonticon_fa5 import FA5S
from qtpy.QtCore import QEasingCurve
from qtpy.QtWidgets import QPushButton

from superqt import QCollapsible
from superqt.fonticon import icon
from superqt.fonticon._qfont_icon import QFontIconStore

TEST_PREFIX = "ico"
TEST_CHARNAME = "smiley"
TEST_CHAR = "\ue900"
TEST_GLYPHKEY = f"{TEST_PREFIX}.{TEST_CHARNAME}"
FONT_FILE = Path(__file__).parent / "test_fonticon/icontest.ttf"


@pytest.fixture
def store(qapp):
store = QFontIconStore().instance()
yield store
store.clear()


@pytest.fixture
def full_store(store):
store.addFont(str(FONT_FILE), TEST_PREFIX, {TEST_CHARNAME: TEST_CHAR})
return store


def test_checked_initialization(qtbot):
Expand Down Expand Up @@ -91,11 +111,10 @@ def test_changing_text(qtbot):


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
def test_setting_icon(qtbot):
def test_setting_icon(qtbot, full_store):
"""Test setting icon for toggle button."""

icon1 = icon(FA5S.smile, color="white")
icon2 = icon(FA5S.frown, color="white")
icon1 = icon(TEST_GLYPHKEY)
icon2 = icon(TEST_GLYPHKEY)

wdg = QCollapsible("test", expandedIcon=icon1, collapsedIcon=icon2)
assert wdg._EXPANDED == icon1
Expand Down

0 comments on commit 8e8723b

Please sign in to comment.