summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm
blob: be58cff8e656f5d3201ac96d7db3f4096a30f9f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#import <AppKit/AppKit.h>

#include <QMenu>
#include <QTest>

void tst_qmenu_QTBUG_37933_ampersands()
{
    QMenu m;
    QFETCH(QString, title);
    QFETCH(QString, visibleTitle);
    m.addAction(title);

    NSMenu* nativeMenu = m.toNSMenu();
    Q_ASSERT(nativeMenu != 0);
    NSMenuItem* item = [nativeMenu itemAtIndex:0];
    Q_ASSERT(item != 0);
    QCOMPARE(QString::fromUtf8([[item title] UTF8String]), visibleTitle);
}