File indexing completed on 2025-02-16 04:23:39
0001 // SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com> 0002 // SPDX-License-Identifier: BSD-2-Clause OR MIT 0003 0004 // First included header is the public header of the class we are testing; 0005 // this forces the header to be self-contained. 0006 #include "xxx.h" 0007 // Second, the private implementation. 0008 #include "xxx_p.h" // IWYU pragma: keep 0009 0010 #include <qtest.h> 0011 #include <qtestcase.h> 0012 0013 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0014 #include <qtmetamacros.h> 0015 #else 0016 #include <qobjectdefs.h> 0017 #include <qstring.h> 0018 #endif 0019 0020 namespace PerceptualColor 0021 { 0022 class TestXXX : public QObject 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 explicit TestXXX(QObject *parent = nullptr) 0028 : QObject(parent) 0029 { 0030 } 0031 0032 private Q_SLOTS: 0033 void initTestCase() 0034 { 0035 // Called before the first test function is executed 0036 } 0037 0038 void cleanupTestCase() 0039 { 0040 // Called after the last test function was executed 0041 } 0042 0043 void init() 0044 { 0045 // Called before each test function is executed 0046 } 0047 0048 void cleanup() 0049 { 0050 // Called after every test function 0051 } 0052 0053 void testDef() 0054 { 0055 // XXX Implement me! 0056 0057 QVERIFY(false); 0058 0059 // It is necessary to show the widget and make it active 0060 // to make focus and widget events working within unit tests. 0061 myWidget->show(); 0062 QApplication::setActiveWindow(myWidget.data()); 0063 0064 // Key clicks must go to the focus widget to work as expected. 0065 widget1->setFocus(); 0066 QTest::keyClick(QApplication::focusWidget(), // 0067 Qt::Key::Key_T, 0068 Qt::KeyboardModifier::AltModifier); 0069 } 0070 }; 0071 0072 } // namespace PerceptualColor 0073 0074 QTEST_MAIN(PerceptualColor::TestXXX) 0075 0076 // The following “include” is necessary because we do not use a header file: 0077 #include "testxxx.moc"