- Add ENABLE_COVERAGE CMake option with gcov flags - Create collect-coverage.sh script for LCOV workflow - Add Qt6 test files with QTest framework - Update Jenkinsfile with Coverage stage (main/master/coverage.*) - Update CI Docker image with lcov and genhtml packages - Add .gitignore entries for coverage artifacts - Add COVERAGE.md documentation Coverage workflow: 1. Configure with -DENABLE_COVERAGE=ON 2. Build and run tests to generate .gcda/.gcno files 3. Collect coverage with lcov 4. Filter out Qt/system libraries 5. Generate HTML report and lcov.info for Jenkins Jenkins publishes coverage/lcov.info using Coverage Plugin. Coverage stage only runs on protected branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Entire-Checkpoint: 7783c7698334 Entire-Checkpoint: 70341e29996b
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include <QtTest/QtTest>
|
|
#include <QApplication>
|
|
#include "MainWindow.h"
|
|
|
|
class TestMainWindowWidget : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void testMainWindowCreation();
|
|
void testWindowTitle();
|
|
void testValidateInputMethod();
|
|
void testGetScreenInfo();
|
|
};
|
|
|
|
void TestMainWindowWidget::testMainWindowCreation()
|
|
{
|
|
MainWindow window;
|
|
QVERIFY(!window.windowTitle().isEmpty());
|
|
}
|
|
|
|
void TestMainWindowWidget::testWindowTitle()
|
|
{
|
|
MainWindow window;
|
|
QCOMPARE(window.windowTitle(), u"Qt6 Legacy Migration Benchmark"_s);
|
|
}
|
|
|
|
void TestMainWindowWidget::testValidateInputMethod()
|
|
{
|
|
MainWindow window;
|
|
|
|
QVERIFY(window.validateInput(u"Test123"_s));
|
|
QVERIFY(window.validateInput(u"abc456"_s));
|
|
QVERIFY(!window.validateInput(u"123Test"_s));
|
|
QVERIFY(!window.validateInput(u""_s));
|
|
}
|
|
|
|
void TestMainWindowWidget::testGetScreenInfo()
|
|
{
|
|
MainWindow window;
|
|
QString info = window.getScreenInfo();
|
|
QVERIFY(!info.isEmpty());
|
|
QVERIFY(info.contains(u"Screen:"_s));
|
|
}
|
|
|
|
QTEST_MAIN(TestMainWindowWidget)
|
|
|
|
#include "test_mainwindow.moc" |