Skip to content

Commit

Permalink
create test_icon for different icon data types
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed May 16, 2020
1 parent c40a24f commit e079383
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_button.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pytest

from msl.qt import io, Button, QtWidgets, QtCore, Qt
Expand All @@ -14,6 +16,31 @@ def test_text():
assert b.toolButtonStyle() == Qt.ToolButtonTextOnly


def test_icon():
path = os.path.dirname(__file__) + '/gamma.png'
gamma_size = QtCore.QSize(191, 291)

int_val = 10
largest_icon_size = io.get_icon(int_val).availableSizes()[-1]
b = Button(icon=int_val)
assert b.text() == ''
assert not b.icon().isNull()
assert b.iconSize() == largest_icon_size
assert b.toolButtonStyle() == Qt.ToolButtonIconOnly

b = Button(icon=path)
assert b.text() == ''
assert not b.icon().isNull()
assert b.iconSize() == gamma_size
assert b.toolButtonStyle() == Qt.ToolButtonIconOnly

b = Button(icon=io.icon_to_base64(io.get_icon(path)))
assert b.text() == ''
assert not b.icon().isNull()
assert b.iconSize() == gamma_size
assert b.toolButtonStyle() == Qt.ToolButtonIconOnly


def test_icon_size():

#
Expand Down

0 comments on commit e079383

Please sign in to comment.