feat: Add LCOV coverage support for Jenkins CI
- 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
This commit is contained in:
1 parent
9e3c6eef2e
commit
8ef6529c0c
19 files changed
+733
-235
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#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"
|
||||
Reference in new issue
Block a user