From 0e888ae1a10750c7f5e644da8f774376f0c8da6a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 7 Oct 2016 10:49:18 +0200 Subject: tst_QGraphicsItem: plug remaining leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Store QGraphicsItems that are either not added to a scene or removed from it again and that are also not children of other items - iow: those that were leaked, even on successful runs of the tests, in either a QScopedPointer, or, where that'd cause too much churn due to adding of .data() calls, back the pointer by a stack-allocated object. This fixes the remaining leaks reported by GCC 6.2.1's ASan on successful runs of tests/auto/widgets/graphicsview/qgraphicsitem. Change-Id: I61c3a1cd39b9e96e83c5d7b8cf392e0b26ecbaf0 Reviewed-by: Edward Welbourne Reviewed-by: Sérgio Martins --- .../qgraphicsitem/tst_qgraphicsitem.cpp | 40 ++++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 8ee9ffe294..4a5a66dd05 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -848,14 +848,14 @@ void tst_QGraphicsItem::parentItem() void tst_QGraphicsItem::setParentItem() { QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); + const QScopedPointer item(scene.addRect(QRectF(0, 0, 10, 10))); QCOMPARE(item->scene(), &scene); - QGraphicsRectItem *child = new QGraphicsRectItem; + const QScopedPointer child(new QGraphicsRectItem); QCOMPARE(child->scene(), (QGraphicsScene *)0); // This implicitly adds the item to the parent's scene - child->setParentItem(item); + child->setParentItem(item.data()); QCOMPARE(child->scene(), &scene); // This just makes it a toplevel @@ -863,8 +863,8 @@ void tst_QGraphicsItem::setParentItem() QCOMPARE(child->scene(), &scene); // Add the child back to the parent, then remove the parent from the scene - child->setParentItem(item); - scene.removeItem(item); + child->setParentItem(item.data()); + scene.removeItem(item.data()); QCOMPARE(child->scene(), (QGraphicsScene *)0); } @@ -962,19 +962,19 @@ void tst_QGraphicsItem::flags() QCOMPARE(item->pos(), QPointF(10, 10)); } { - QGraphicsItem* clippingParent = new QGraphicsRectItem; + const QScopedPointer clippingParent(new QGraphicsRectItem); clippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); - QGraphicsItem* nonClippingParent = new QGraphicsRectItem; + const QScopedPointer nonClippingParent(new QGraphicsRectItem); nonClippingParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false); - QGraphicsItem* child = new QGraphicsRectItem(nonClippingParent); + QGraphicsItem* child = new QGraphicsRectItem(nonClippingParent.data()); QVERIFY(!child->isClipped()); - child->setParentItem(clippingParent); + child->setParentItem(clippingParent.data()); QVERIFY(child->isClipped()); - child->setParentItem(nonClippingParent); + child->setParentItem(nonClippingParent.data()); QVERIFY(!child->isClipped()); } } @@ -3133,7 +3133,8 @@ void tst_QGraphicsItem::isAncestorOf() void tst_QGraphicsItem::commonAncestorItem() { - QGraphicsItem *ancestor = new QGraphicsRectItem; + QGraphicsRectItem ancestorItem; + QGraphicsItem *ancestor = &ancestorItem; QGraphicsItem *grandMa = new QGraphicsRectItem; QGraphicsItem *grandPa = new QGraphicsRectItem; QGraphicsItem *brotherInLaw = new QGraphicsRectItem; @@ -3633,7 +3634,7 @@ void tst_QGraphicsItem::setGroup() QGraphicsItemGroup group1; QGraphicsItemGroup group2; - QGraphicsRectItem *rect = new QGraphicsRectItem; + const QScopedPointer rect(new QGraphicsRectItem); QCOMPARE(rect->group(), (QGraphicsItemGroup *)0); QCOMPARE(rect->parentItem(), (QGraphicsItem *)0); rect->setGroup(&group1); @@ -6831,8 +6832,8 @@ void tst_QGraphicsItem::opacity() QFETCH(qreal, c2_effectiveOpacity); QFETCH(qreal, c3_effectiveOpacity); - QGraphicsRectItem *p = new QGraphicsRectItem; - QGraphicsRectItem *c1 = new QGraphicsRectItem(p); + const QScopedPointer p(new QGraphicsRectItem); + QGraphicsRectItem *c1 = new QGraphicsRectItem(p.data()); QGraphicsRectItem *c2 = new QGraphicsRectItem(c1); QGraphicsRectItem *c3 = new QGraphicsRectItem(c2); @@ -7219,11 +7220,12 @@ void tst_QGraphicsItem::sceneTransformCache() // Test that an item's scene transform is updated correctly when the // parent is transformed. QGraphicsScene scene; - QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + + const QScopedPointer rect(scene.addRect(0, 0, 100, 100)); rect->setPen(QPen(Qt::black, 0)); QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100); rect2->setPen(QPen(Qt::black, 0)); - rect2->setParentItem(rect); + rect2->setParentItem(rect.data()); rect2->rotate(90); rect->translate(0, 50); QGraphicsView view(&scene); @@ -7235,7 +7237,7 @@ void tst_QGraphicsItem::sceneTransformCache() x.rotate(90); QCOMPARE(rect2->sceneTransform(), x); - scene.removeItem(rect); + scene.removeItem(rect.data()); //Crazy use case : rect4 child of rect3 so the transformation of rect4 will be cached.Good! //We remove rect4 from the scene, then the validTransform bit flag is set to 0 and the index of the cache @@ -10688,7 +10690,7 @@ void tst_QGraphicsItem::scenePosChange() { ScenePosChangeTester* root = new ScenePosChangeTester; ScenePosChangeTester* child1 = new ScenePosChangeTester(root); - ScenePosChangeTester* grandChild1 = new ScenePosChangeTester(child1); + const QScopedPointer grandChild1(new ScenePosChangeTester(child1)); ScenePosChangeTester* child2 = new ScenePosChangeTester(root); ScenePosChangeTester* grandChild2 = new ScenePosChangeTester(child2); @@ -10740,7 +10742,7 @@ void tst_QGraphicsItem::scenePosChange() QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3); // remove - scene.removeItem(grandChild1); + scene.removeItem(grandChild1.data()); delete grandChild2; grandChild2 = 0; QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants() root->moveBy(1.0, 1.0); -- cgit v1.2.3 From e70e168abb4b75dc8d00e2cba12efa1a111d429d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 29 Sep 2016 09:06:12 +0200 Subject: Plug leaks in tst_QWizard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This completely over-engineered piece of code has a hierarchy of Operation subclasses encapsulating but three actual operations on a QWizard. Because these operations and their containers were all allocated on the heap, but never deleted, asan went crazy and reported over 50 leaks (not the record so far, but a (distant) second). Since these collections are passed through addColumn/QFETCH, too, it's nearly impossible to track their lifetimes. So instead of trying, delegate that to the runtime, ie. pack the Operation objects into QSharedPointer and pass around those instead. Change-Id: I8a0fe7a60cd30aed618667affaa030e80cf2b1ac Reviewed-by: Edward Welbourne Reviewed-by: Sérgio Martins --- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 106 ++++++++++++--------- 1 file changed, 60 insertions(+), 46 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index b2bdbac79a..5789f0ca42 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -1626,28 +1626,44 @@ class SetPage : public Operation wizard->next(); } QString describe() const { return QString("set page %1").arg(page); } - const int page; + int page; public: - SetPage(int page) : page(page) {} + static QSharedPointer create(int page) + { + QSharedPointer o = QSharedPointer::create(); + o->page = page; + return o; + } }; class SetStyle : public Operation { void apply(QWizard *wizard) const { wizard->setWizardStyle(style); } QString describe() const { return QString("set style %1").arg(style); } - const QWizard::WizardStyle style; + QWizard::WizardStyle style; public: - SetStyle(QWizard::WizardStyle style) : style(style) {} + static QSharedPointer create(QWizard::WizardStyle style) + { + QSharedPointer o = QSharedPointer::create(); + o->style = style; + return o; + } }; class SetOption : public Operation { void apply(QWizard *wizard) const { wizard->setOption(option, on); } QString describe() const; - const QWizard::WizardOption option; - const bool on; + QWizard::WizardOption option; + bool on; public: - SetOption(QWizard::WizardOption option, bool on) : option(option), on(on) {} + static QSharedPointer create(QWizard::WizardOption option, bool on) + { + QSharedPointer o = QSharedPointer::create(); + o->option = option; + o->on = on; + return o; + } }; class OptionInfo @@ -1672,16 +1688,16 @@ class OptionInfo tags[QWizard::HaveCustomButton3] = "15/CB3"; for (int i = 0; i < 2; ++i) { - QMap operations_; + QMap > operations_; foreach (QWizard::WizardOption option, tags.keys()) - operations_[option] = new SetOption(option, i == 1); + operations_[option] = SetOption::create(option, i == 1); operations << operations_; } } OptionInfo(OptionInfo const&); OptionInfo& operator=(OptionInfo const&); QMap tags; - QList > operations; + QList > > operations; public: static OptionInfo &instance() { @@ -1690,7 +1706,7 @@ public: } QString tag(QWizard::WizardOption option) const { return tags.value(option); } - Operation * operation(QWizard::WizardOption option, bool on) const + QSharedPointer operation(QWizard::WizardOption option, bool on) const { return operations.at(on).value(option); } QList options() const { return tags.keys(); } }; @@ -1700,10 +1716,7 @@ QString SetOption::describe() const return QString("set opt %1 %2").arg(OptionInfo::instance().tag(option)).arg(on); } -Q_DECLARE_METATYPE(Operation *) -Q_DECLARE_METATYPE(SetPage *) -Q_DECLARE_METATYPE(SetStyle *) -Q_DECLARE_METATYPE(SetOption *) +Q_DECLARE_METATYPE(QVector >) class TestGroup { @@ -1720,14 +1733,17 @@ public: combinations.clear(); } - QList &add() - { combinations << new QList; return *(combinations.last()); } + QVector > &add() + { + combinations.resize(combinations.size() + 1); + return combinations.last(); + } void createTestRows() { for (int i = 0; i < combinations.count(); ++i) { QTest::newRow((name + QString(", row %1").arg(i)).toLatin1().data()) - << (i == 0) << (type == Equality) << *(combinations.at(i)); + << (i == 0) << (type == Equality) << combinations.at(i); ++nRows_; } } @@ -1738,7 +1754,7 @@ private: QString name; Type type; int nRows_; - QList *> combinations; + QVector > > combinations; }; class IntroPage : public QWizardPage @@ -1822,9 +1838,9 @@ public: } } - void applyOperations(const QList &operations) + void applyOperations(const QVector > &operations) { - foreach (Operation * op, operations) { + foreach (const QSharedPointer &op, operations) { if (op) { op->apply(this); opsDescr += QString("(%1) ").arg(op->describe()); @@ -1844,31 +1860,29 @@ public: class CombinationsTestData { TestGroup testGroup; - QList pageOps; - QList styleOps; - QMap *> setAllOptions; + QVector > pageOps; + QVector > styleOps; + QMap > > setAllOptions; public: CombinationsTestData() { QTest::addColumn("ref"); QTest::addColumn("testEquality"); - QTest::addColumn >("operations"); - pageOps << new SetPage(0) << new SetPage(1) << new SetPage(2); - styleOps << new SetStyle(QWizard::ClassicStyle) << new SetStyle(QWizard::ModernStyle) - << new SetStyle(QWizard::MacStyle); + QTest::addColumn > >("operations"); + pageOps << SetPage::create(0) << SetPage::create(1) << SetPage::create(2); + styleOps << SetStyle::create(QWizard::ClassicStyle) << SetStyle::create(QWizard::ModernStyle) + << SetStyle::create(QWizard::MacStyle); #define SETPAGE(page) pageOps.at(page) #define SETSTYLE(style) styleOps.at(style) #define OPT(option, on) OptionInfo::instance().operation(option, on) #define CLROPT(option) OPT(option, false) #define SETOPT(option) OPT(option, true) - setAllOptions[false] = new QList; - setAllOptions[true] = new QList; foreach (QWizard::WizardOption option, OptionInfo::instance().options()) { - *setAllOptions.value(false) << CLROPT(option); - *setAllOptions.value(true) << SETOPT(option); + setAllOptions[false] << CLROPT(option); + setAllOptions[true] << SETOPT(option); } -#define CLRALLOPTS *setAllOptions.value(false) -#define SETALLOPTS *setAllOptions.value(true) +#define CLRALLOPTS setAllOptions.value(false) +#define SETALLOPTS setAllOptions.value(true) } int nRows() const { return testGroup.nRows(); } @@ -1920,7 +1934,7 @@ public: testGroup.createTestRows(); for (int i = 0; i < 2; ++i) { - QList setOptions = *setAllOptions.value(i == 1); + QVector > setOptions = setAllOptions.value(i == 1); testGroup.reset("testAll 3.1"); testGroup.add() << setOptions; @@ -1937,21 +1951,21 @@ public: testGroup.createTestRows(); } - foreach (Operation *pageOp, pageOps) { + foreach (const QSharedPointer &pageOp, pageOps) { testGroup.reset("testAll 4.1"); testGroup.add() << pageOp; testGroup.add() << pageOp << pageOp; testGroup.createTestRows(); for (int i = 0; i < 2; ++i) { - QList optionOps = *setAllOptions.value(i == 1); + QVector > optionOps = setAllOptions.value(i == 1); testGroup.reset("testAll 4.2"); testGroup.add() << optionOps << pageOp; testGroup.add() << pageOp << optionOps; testGroup.createTestRows(); foreach (QWizard::WizardOption option, OptionInfo::instance().options()) { - Operation *optionOp = OPT(option, i == 1); + QSharedPointer optionOp = OPT(option, i == 1); testGroup.reset("testAll 4.3"); testGroup.add() << optionOp << pageOp; testGroup.add() << pageOp << optionOp; @@ -1960,21 +1974,21 @@ public: } } - foreach (Operation *styleOp, styleOps) { + foreach (const QSharedPointer &styleOp, styleOps) { testGroup.reset("testAll 5.1"); testGroup.add() << styleOp; testGroup.add() << styleOp << styleOp; testGroup.createTestRows(); for (int i = 0; i < 2; ++i) { - QList optionOps = *setAllOptions.value(i == 1); + QVector > optionOps = setAllOptions.value(i == 1); testGroup.reset("testAll 5.2"); testGroup.add() << optionOps << styleOp; testGroup.add() << styleOp << optionOps; testGroup.createTestRows(); foreach (QWizard::WizardOption option, OptionInfo::instance().options()) { - Operation *optionOp = OPT(option, i == 1); + QSharedPointer optionOp = OPT(option, i == 1); testGroup.reset("testAll 5.3"); testGroup.add() << optionOp << styleOp; testGroup.add() << styleOp << optionOp; @@ -1983,8 +1997,8 @@ public: } } - foreach (Operation *pageOp, pageOps) { - foreach (Operation *styleOp, styleOps) { + foreach (const QSharedPointer &pageOp, pageOps) { + foreach (const QSharedPointer &styleOp, styleOps) { testGroup.reset("testAll 6.1"); testGroup.add() << pageOp; @@ -2002,7 +2016,7 @@ public: testGroup.createTestRows(); for (int i = 0; i < 2; ++i) { - QList optionOps = *setAllOptions.value(i == 1); + QVector > optionOps = setAllOptions.value(i == 1); testGroup.reset("testAll 6.4"); testGroup.add() << optionOps << pageOp << styleOp; testGroup.add() << pageOp << optionOps << styleOp; @@ -2013,7 +2027,7 @@ public: testGroup.createTestRows(); foreach (QWizard::WizardOption option, OptionInfo::instance().options()) { - Operation *optionOp = OPT(option, i == 1); + QSharedPointer optionOp = OPT(option, i == 1); testGroup.reset("testAll 6.5"); testGroup.add() << optionOp << pageOp << styleOp; testGroup.add() << pageOp << optionOp << styleOp; @@ -2079,7 +2093,7 @@ void tst_QWizard::combinations() QFETCH(bool, ref); QFETCH(bool, testEquality); - QFETCH(QList, operations); + QFETCH(QVector >, operations); TestWizard wizard; #if !defined(QT_NO_STYLE_WINDOWSVISTA) -- cgit v1.2.3 From f6eb570c7dee2ec92383607c614db91f31804707 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 29 Sep 2016 11:59:01 +0200 Subject: Darwin: normalize all watched paths to composed from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be done by all POSIX APIs for strings coming in that way, but because other code (like NSWhateverViews) will most likely return decomposed form, we make sure that those are in composed form too. Task-number: QTBUG-55896 Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8 Reviewed-by: Morten Johan Sørvig --- .../qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 026743257c..4ede1e69f3 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -78,6 +78,8 @@ private slots: void signalsEmittedAfterFileMoved(); + void watchUnicodeCharacters(); + private: QString m_tempDirPattern; #endif // QT_NO_FILESYSTEMWATCHER @@ -763,6 +765,25 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved() QVERIFY2(changedSpy.count() <= fileCount, changedSpy.receivedFilesMessage()); QTRY_COMPARE(changedSpy.count(), fileCount); } + +void tst_QFileSystemWatcher::watchUnicodeCharacters() +{ + QTemporaryDir temporaryDirectory(m_tempDirPattern); + QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString())); + + QDir testDir(temporaryDirectory.path()); + const QString subDir(QString::fromLatin1("caf\xe9")); + QVERIFY(testDir.mkdir(subDir)); + testDir = QDir(temporaryDirectory.path() + QDir::separator() + subDir); + + QFileSystemWatcher watcher; + QVERIFY(watcher.addPath(testDir.path())); + + FileSystemWatcherSpy changedSpy(&watcher, FileSystemWatcherSpy::SpyOnDirectoryChanged); + QCOMPARE(changedSpy.count(), 0); + QVERIFY(testDir.mkdir("creme")); + QTRY_COMPARE(changedSpy.count(), 1); +} #endif // QT_NO_FILESYSTEMWATCHER QTEST_MAIN(tst_QFileSystemWatcher) -- cgit v1.2.3 From 9c83d7f871f95b1cc03fb404bd602df32056b9cb Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 30 Sep 2016 15:39:03 -0700 Subject: QCocoaMenuBar: Update even if no window is attached Then we need to check if the current active (or focused) window has any menubar associated. In case there isn't, and the menubar has no window associated, then we should update immediately. The previous condition is still valid. Change-Id: I4532ccc87354d91c76b53f5433dc3944b9e29584 Task-number: QTBUG-56275 Reviewed-by: Erik Verbruggen --- tests/auto/widgets/widgets/qmenubar/qmenubar.pro | 5 +++ .../auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 24 ++++++++++++ .../widgets/widgets/qmenubar/tst_qmenubar_mac.mm | 44 ++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro index 3fb6ae61a8..e680cf4d7d 100644 --- a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro +++ b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro @@ -2,3 +2,8 @@ CONFIG += testcase TARGET = tst_qmenubar QT += widgets testlib SOURCES += tst_qmenubar.cpp + +macos: { + OBJECTIVE_SOURCES += tst_qmenubar_mac.mm + LIBS += -framework AppKit +} diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index b2d15fffef..45eae18240 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -133,6 +133,9 @@ private slots: void cornerWidgets_data(); void cornerWidgets(); void taskQTBUG53205_crashReparentNested(); +#ifdef Q_OS_MACOS + void taskQTBUG56275_reinsertMenuInParentlessQMenuBar(); +#endif protected slots: void onSimpleActivated( QAction*); @@ -1495,7 +1498,28 @@ void tst_QMenuBar::slotForTaskQTBUG53205() taskQTBUG53205MenuBar->setParent(parent); } +#ifdef Q_OS_MACOS +extern bool tst_qmenubar_taskQTBUG56275(QMenuBar *); + +void tst_QMenuBar::taskQTBUG56275_reinsertMenuInParentlessQMenuBar() +{ + QMenuBar menubar; + QMenu *menu = new QMenu("menu", &menubar); + QMenu* submenu = menu->addMenu("submenu"); + submenu->addAction("action1"); + submenu->addAction("action2"); + menu->addAction("action3"); + menubar.addMenu(menu); + + QTest::qWait(100); + menubar.clear(); + menubar.addMenu(menu); + QTest::qWait(100); + + QVERIFY(tst_qmenubar_taskQTBUG56275(&menubar)); +} +#endif // Q_OS_MACOS QTEST_MAIN(tst_QMenuBar) #include "tst_qmenubar.moc" diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm new file mode 100644 index 0000000000..4645de4d7a --- /dev/null +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar_mac.mm @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#import + +#include +#include + +bool tst_qmenubar_taskQTBUG56275(QMenuBar *menubar) +{ + NSMenu *mainMenu = menubar->toNSMenu(); + return mainMenu.numberOfItems == 2 + && [[mainMenu itemAtIndex:1].title isEqualToString:@"menu"]; +} -- cgit v1.2.3 From 047e3f8f046ac9267cc27d47a48189ae2cbfe0ef Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Sep 2016 15:14:22 -0700 Subject: Autotest: fix silly mistake in assigning where a comparison was intended MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The file descriptor has been closed and this test is checking if we get EBADF. Change-Id: I33dc971f005a4848bb8ffffd1478eaffd99aa2e9 Reviewed-by: Jake Petroules Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index b38620fcbb..b26db788de 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -3446,7 +3446,7 @@ void tst_QFile::autocloseHandle() //file is closed, read should fail char buf; QCOMPARE((int)QT_READ(fd, &buf, 1), -1); - QVERIFY(errno = EBADF); + QVERIFY(errno == EBADF); } { -- cgit v1.2.3