- 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 Signed-off-by: twi-devel <torsten.wierschin@life-maps.com>
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#include <QtTest/QtTest>
|
|
|
|
class TestMainWindow : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void testValidateInputValid();
|
|
void testValidateInputInvalid();
|
|
void testValidateInputEmpty();
|
|
void testValidateInputMixedCase();
|
|
};
|
|
|
|
void TestMainWindow::testValidateInputValid()
|
|
{
|
|
// Test valid input patterns
|
|
QRegularExpression pattern(R"(^[A-Za-z]+\d+$)");
|
|
|
|
QVERIFY(pattern.match("Test123").hasMatch());
|
|
QVERIFY(pattern.match("abc456").hasMatch());
|
|
QVERIFY(pattern.match("ABC789").hasMatch());
|
|
}
|
|
|
|
void TestMainWindow::testValidateInputInvalid()
|
|
{
|
|
// Test invalid input patterns
|
|
QRegularExpression pattern(R"(^[A-Za-z]+\d+$)");
|
|
|
|
QVERIFY(!pattern.match("123Test").hasMatch());
|
|
QVERIFY(!pattern.match("Test").hasMatch());
|
|
QVERIFY(!pattern.match("123").hasMatch());
|
|
QVERIFY(!pattern.match("Test123ABC").hasMatch());
|
|
QVERIFY(!pattern.match("Test-123").hasMatch());
|
|
}
|
|
|
|
void TestMainWindow::testValidateInputEmpty()
|
|
{
|
|
QRegularExpression pattern(R"(^[A-Za-z]+\d+$)");
|
|
QVERIFY(!pattern.match("").hasMatch());
|
|
}
|
|
|
|
void TestMainWindow::testValidateInputMixedCase()
|
|
{
|
|
QRegularExpression pattern(R"(^[A-Za-z]+\d+$)");
|
|
|
|
QVERIFY(pattern.match("TeSt123").hasMatch());
|
|
QVERIFY(pattern.match("aBcDeF999").hasMatch());
|
|
}
|
|
|
|
QTEST_MAIN(TestMainWindow)
|
|
|
|
#include "test_main.moc" |