aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtGui
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2021-09-30 14:10:42 +0200
committerChristian Tismer <[email protected]>2021-10-27 16:22:34 +0200
commit3aab0899ef4f966d3a37c0e95b0e7d0f047de3e0 (patch)
tree20f31210538616eeb7759add719d918d2c716b33 /sources/pyside6/tests/QtGui
parent73415e134b75876d547667c6eeb7052f76750687 (diff)
Fix QIcon.addPixmap() to accept a PyPathLike argument
By modifying functions to accept a PyPathLike argument, we saw the side-effect of disabling implicit conversions. In an alternative branch, we tried to re-enable implicit conversion by adding new functions with a PyPathLike argument. This worked, but had drawbacks: * the signatures become redundant, and some post-processing must be implemented * the implicit conversion works fine, but only with a string argument. Much better would be to supply a PyPathLike This patch leaves the modifications of function arguments and simply adds the missing icon.addPixmap(PyPathLike). Other implicit conversions which might be found missing should be added the same way. [ChangeLog][shiboken6] The implicit conversion of icon.addPixmap(str) was replaced by an explicit version which takes PyPathLike. Change-Id: I48a2887e28473718f027059df2aafdd516f66dc3 Fixes: PYSIDE-1669 Task-number: PYSIDE-1499 Pick-to: 6.2 Reviewed-by: Friedemann Kleint <[email protected]>
Diffstat (limited to 'sources/pyside6/tests/QtGui')
-rw-r--r--sources/pyside6/tests/QtGui/qicon_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py
index 1387ff76b..2301793bc 100644
--- a/sources/pyside6/tests/QtGui/qicon_test.py
+++ b/sources/pyside6/tests/QtGui/qicon_test.py
@@ -48,5 +48,25 @@ class QIconCtorWithNoneTest(TimedQApplication):
self.app.exec()
+PIX_PATH = os.fspath(Path(__file__).resolve().parents[2]
+ / "doc/tutorials/basictutorial/icons.png")
+
+class QIconAddPixmapTest(TimedQApplication):
+ '''PYSIDE-1669: check that addPixmap works'''
+
+ def testQIconSetPixmap(self):
+ icon = QIcon()
+ icon.addPixmap(PIX_PATH)
+ sizes = icon.availableSizes()
+ self.assertTrue(sizes)
+
+ def testQIconSetPixmapPathlike(self):
+ icon = QIcon()
+ pix_path = Path(PIX_PATH)
+ icon.addPixmap(pix_path)
+ sizes = icon.availableSizes()
+ self.assertTrue(sizes)
+
+
if __name__ == '__main__':
unittest.main()