1 /* 2 SPDX-FileCopyrightText: 2013 Albert Astals Cid <aacid@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #include "kcolorbuttontest.h" 8 9 #include <QColorDialog> 10 #include <QTest> 11 #include <kcolorbutton.h> 12 QTEST_MAIN(KColorButtonTest)13QTEST_MAIN(KColorButtonTest) 14 15 void KColorButtonTest::testWaitForWindowExposed() 16 { 17 // because this test fails in the Windows CI, in qWaitForWindowExposed 18 // let's test that here 19 QWindow a; 20 a.setVisible(true); 21 QVERIFY(QTest::qWaitForWindowExposed(&a)); 22 } 23 testOpenDialog()24void KColorButtonTest::testOpenDialog() 25 { 26 KColorButton colorButton(Qt::red); 27 colorButton.show(); 28 QVERIFY(QTest::qWaitForWindowExposed(&colorButton)); 29 QTest::mouseClick(&colorButton, Qt::LeftButton); 30 QColorDialog *dialog = colorButton.findChild<QColorDialog *>(); 31 QVERIFY(dialog != nullptr); 32 QVERIFY(QTest::qWaitForWindowExposed(dialog)); 33 QCOMPARE(dialog->currentColor(), QColor(Qt::red)); 34 } 35