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
@@ -1,23 +1,24 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPixmap>
|
||||
#include <QScreen>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
#include <QRect>
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: QMainWindow(parent), ui(new Ui::MainWindow), pattern(QRegularExpression(R"(^[A-Za-z]+\d+$)"))
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
, m_pattern(QRegularExpression(R"(^[A-Za-z]+\d+$)"))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Qt6 uses UTF-8 by default; no codec needed
|
||||
setWindowTitle(QString::fromUtf8("Qt6 Migrated Benchmark"));
|
||||
ui->label->setText(QString::fromUtf8("Bitte Text wie Test123 eingeben."));
|
||||
ui->iconLabel->setPixmap(QPixmap(":/icons/app.png").scaled(48, 48));
|
||||
setWindowTitle(u"Qt6 Legacy Migration Benchmark"_s);
|
||||
|
||||
ui->label->setText(u"Bitte Text wie Test123 eingeben."_s);
|
||||
ui->iconLabel->setPixmap(QPixmap(u":/icons/app.png"_s).scaled(48, 48));
|
||||
|
||||
// Modern function-pointer connect syntax
|
||||
connect(ui->validateButton, &QPushButton::clicked, this, &MainWindow::onValidateClicked);
|
||||
connect(ui->screenButton, &QPushButton::clicked, this, &MainWindow::onScreenInfoClicked);
|
||||
}
|
||||
@@ -27,29 +28,34 @@ MainWindow::~MainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool MainWindow::validateInput(const QString &text) const
|
||||
{
|
||||
return m_pattern.match(text).hasMatch();
|
||||
}
|
||||
|
||||
QString MainWindow::getScreenInfo() const
|
||||
{
|
||||
const QScreen *screen = QApplication::primaryScreen();
|
||||
if (!screen) {
|
||||
return u"Screen: unavailable"_s;
|
||||
}
|
||||
const QRect geometry = screen->geometry();
|
||||
return u"Screen: %1x%2"_s.arg(geometry.width()).arg(geometry.height());
|
||||
}
|
||||
|
||||
void MainWindow::onValidateClicked()
|
||||
{
|
||||
const QString text = ui->lineEdit->text();
|
||||
|
||||
if (pattern.match(text).hasMatch())
|
||||
{
|
||||
ui->resultLabel->setText(QString::fromUtf8("Match"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->resultLabel->setText(QString::fromUtf8("No match"));
|
||||
if (validateInput(text)) {
|
||||
ui->resultLabel->setText(u"Match"_s);
|
||||
} else {
|
||||
ui->resultLabel->setText(u"No match"_s);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onScreenInfoClicked()
|
||||
{
|
||||
// Qt6: Use QScreen instead of deprecated QDesktopWidget
|
||||
const QScreen* screen = QApplication::primaryScreen();
|
||||
if (screen)
|
||||
{
|
||||
const QRect screenGeometry = screen->geometry();
|
||||
const QString info =
|
||||
QString::fromUtf8("Screen: %1x%2").arg(screenGeometry.width()).arg(screenGeometry.height());
|
||||
ui->resultLabel->setText(info);
|
||||
}
|
||||
const QString info = getScreenInfo();
|
||||
ui->resultLabel->setText(info);
|
||||
}
|
||||
Reference in new issue
Block a user