diff options
author | David Faure <david.faure@kdab.com> | 2014-11-17 18:35:52 +0100 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2014-11-21 00:42:55 +0100 |
commit | eb466b636b97251d273aedddfe66b15fe994d375 (patch) | |
tree | dbc223dcb06a4908d5a75e3b599c5cfe6ae59507 /tests/auto/widgets | |
parent | 6c5d1dbd75f4edf886420cb07efeb1c20a1b0bbf (diff) |
Fix QAction::setFont crash on OSX, when font is unknown.
customMenuFont was null, so objects was an empty array, and
NSDictionary throws an exception when being called with arrays
of different sizes.
Task-number: QTBUG-42728
Change-Id: I8cdab449fd8c1d12b65c46dd5617a7f5e3e96c6e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 7904848faf..4b7e2a7198 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -61,6 +61,7 @@ private slots: void setText(); void setIconText_data() { setText_data(); } void setIconText(); + void setUnknownFont(); void actionEvent(); void setStandardKeys(); void alternateShortcuts(); @@ -184,6 +185,15 @@ void tst_QAction::setIconText() QCOMPARE(action.text(), textFromIconText); } +void tst_QAction::setUnknownFont() // QTBUG-42728 +{ + QAction action(0); + QFont font("DoesNotExist", 11); + action.setFont(font); + + QMenu menu; + menu.addAction(&action); // should not crash +} void tst_QAction::updateState(QActionEvent *e) { |