diff options
author | Dmytro Tyshchenko <dimitri@froglogic.com> | 2013-03-20 15:22:12 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2013-04-11 09:38:52 +0200 |
commit | 821fee46acba9da0f8e58e85c66ee89af06ac9af (patch) | |
tree | 9bdf5df7afd6fbabe342454ae99ba8a3871e3785 /tests | |
parent | d181392b15037d36e5bfde629492167266d9b5ee (diff) |
Add overload to toNSMenu() to get NSMenu handle from QMenuBar object.
Task-number: QTBUG-28869
Change-Id: I33e7a875a8f1aa8d6db7efbd95b662b4b6c182ce
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/macfunctions/tst_qmacfunctions.mm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/macfunctions/tst_qmacfunctions.mm b/tests/auto/macfunctions/tst_qmacfunctions.mm index 12b9327..e7a36e5 100644 --- a/tests/auto/macfunctions/tst_qmacfunctions.mm +++ b/tests/auto/macfunctions/tst_qmacfunctions.mm @@ -57,14 +57,14 @@ public: tst_QMacFunctions(); private slots: - void testQMenuToNSMenu(); + void testToNSMenu(); }; tst_QMacFunctions::tst_QMacFunctions() { } -void tst_QMacFunctions::testQMenuToNSMenu() +void tst_QMacFunctions::testToNSMenu() { QMainWindow window; QMenu *qMenu = new QMenu("Menu", &window); @@ -78,6 +78,14 @@ void tst_QMacFunctions::testQMenuToNSMenu() NSMenuItem *item = [nsMenu itemAtIndex:0]; QCOMPARE([[item title] UTF8String], "Item"); + + // get NSMenu from QMenuBar + nsMenu = QtMacExtras::toNSMenu(window.menuBar()); + QVERIFY(nsMenu != NULL); + + // the first item should be our menu + item = [nsMenu itemAtIndex:0]; + QCOMPARE([[item title] UTF8String], "Menu"); } QTEST_MAIN(tst_QMacFunctions) |