Changeset View
Changeset View
Standalone View
Standalone View
autotests/ktoolbar_unittest.cpp
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | |||||
87 | 87 | | |||
88 | QTEST_MAIN(tst_KToolBar) | 88 | QTEST_MAIN(tst_KToolBar) | ||
89 | 89 | | |||
90 | static void copy_dir(const QString &from, const QDir &to) | 90 | static void copy_dir(const QString &from, const QDir &to) | ||
91 | { | 91 | { | ||
92 | QDir src = QDir(from); | 92 | QDir src = QDir(from); | ||
93 | QDir dest = QDir(to.filePath(src.dirName())); | 93 | QDir dest = QDir(to.filePath(src.dirName())); | ||
94 | to.mkpath(src.dirName()); | 94 | to.mkpath(src.dirName()); | ||
95 | foreach (const QFileInfo &fileInfo, src.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) { | 95 | const auto fileInfos = src.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); | ||
96 | for (const QFileInfo &fileInfo : fileInfos) { | ||||
96 | if (fileInfo.isDir()) { | 97 | if (fileInfo.isDir()) { | ||
97 | copy_dir(fileInfo.filePath(), dest); | 98 | copy_dir(fileInfo.filePath(), dest); | ||
98 | } else { | 99 | } else { | ||
99 | QFile::copy(fileInfo.filePath(), dest.filePath(fileInfo.fileName())); | 100 | QFile::copy(fileInfo.filePath(), dest.filePath(fileInfo.fileName())); | ||
100 | } | 101 | } | ||
101 | } | 102 | } | ||
102 | } | 103 | } | ||
103 | 104 | | |||
▲ Show 20 Lines • Show All 543 Lines • ▼ Show 20 Line(s) | 541 | { | |||
647 | } | 648 | } | ||
648 | } | 649 | } | ||
649 | 650 | | |||
650 | void tst_KToolBar::testKAuthorizedDisableToggleAction() | 651 | void tst_KToolBar::testKAuthorizedDisableToggleAction() | ||
651 | { | 652 | { | ||
652 | TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc"); | 653 | TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc"); | ||
653 | kmw.createGUI(); | 654 | kmw.createGUI(); | ||
654 | 655 | | |||
655 | foreach (KToolBar *toolbar, kmw.toolBars()) { | 656 | const auto toolbars = kmw.toolBars(); | ||
657 | for (KToolBar *toolbar: toolbars) { | ||||
656 | QVERIFY(!toolbar->toggleViewAction()->isEnabled()); | 658 | QVERIFY(!toolbar->toggleViewAction()->isEnabled()); | ||
657 | } | 659 | } | ||
658 | } | 660 | } | ||
659 | 661 | | |||
660 | bool tst_KToolBar::eventFilter(QObject *watched, QEvent *event) | 662 | bool tst_KToolBar::eventFilter(QObject *watched, QEvent *event) | ||
661 | { | 663 | { | ||
662 | Q_UNUSED(watched); | 664 | Q_UNUSED(watched); | ||
663 | if (event->type() == QEvent::Show) { | 665 | if (event->type() == QEvent::Show) { | ||
664 | m_showWasCalled = true; | 666 | m_showWasCalled = true; | ||
665 | return true; | 667 | return true; | ||
666 | } | 668 | } | ||
667 | return false; | 669 | return false; | ||
668 | } | 670 | } | ||
669 | 671 | | |||
670 | #include "ktoolbar_unittest.moc" | 672 | #include "ktoolbar_unittest.moc" |