Fix Dockerfile: GID 1001, remove genhtml (included in lcov), cleanup test file
qt-migration-copilot-demo/pipeline/pr-main There was a failure building this commit
qt-migration-copilot-demo/pipeline/pr-main There was a failure building this commit
Entire-Checkpoint: 0d9a8cfb0768
This commit is contained in:
2 files changed
+4
-93
No files matched your search
+4
-5
@@ -2,9 +2,9 @@ FROM ubuntu:26.04
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Create jenkins user with same UID as host jenkins (typically 1000)
|
# Create jenkins user (UID 1001 to avoid conflicts with existing users)
|
||||||
RUN groupadd -g 1000 jenkins && \
|
RUN groupadd -g 1001 jenkins && \
|
||||||
useradd -u 1000 -g 1000 -m -s /bin/bash jenkins
|
useradd -u 1001 -g 1001 -m -s /bin/bash jenkins
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
@@ -23,8 +23,7 @@ RUN apt-get update && \
|
|||||||
qt6-base-dev-tools \
|
qt6-base-dev-tools \
|
||||||
qt6-tools-dev \
|
qt6-tools-dev \
|
||||||
qt6-tools-dev-tools \
|
qt6-tools-dev-tools \
|
||||||
lcov \
|
lcov && \
|
||||||
genhtml && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set Qt platform for headless testing
|
# Set Qt platform for headless testing
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
#include "MainWindow.h"
|
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
|
||||||
|
|
||||||
class TestMainWindow : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void testValidateInputValid();
|
|
||||||
void testValidateInputInvalid();
|
|
||||||
void testValidateInputEmpty();
|
|
||||||
void testValidateInputMixedCase();
|
|
||||||
void testMainWindowCreation();
|
|
||||||
void testWindowTitle();
|
|
||||||
void testValidateInputMethod();
|
|
||||||
void testGetScreenInfo();
|
|
||||||
};
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestMainWindow::testMainWindowCreation()
|
|
||||||
{
|
|
||||||
MainWindow window;
|
|
||||||
QVERIFY(!window.windowTitle().isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestMainWindow::testWindowTitle()
|
|
||||||
{
|
|
||||||
MainWindow window;
|
|
||||||
QCOMPARE(window.windowTitle(), QStringLiteral("Qt6 Legacy Migration Benchmark"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestMainWindow::testValidateInputMethod()
|
|
||||||
{
|
|
||||||
MainWindow window;
|
|
||||||
|
|
||||||
QVERIFY(window.validateInput(QStringLiteral("Test123")));
|
|
||||||
QVERIFY(window.validateInput(QStringLiteral("abc456")));
|
|
||||||
QVERIFY(!window.validateInput(QStringLiteral("123Test")));
|
|
||||||
QVERIFY(!window.validateInput(QStringLiteral("")));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestMainWindow::testGetScreenInfo()
|
|
||||||
{
|
|
||||||
MainWindow window;
|
|
||||||
QString info = window.getScreenInfo();
|
|
||||||
QVERIFY(!info.isEmpty());
|
|
||||||
QVERIFY(info.contains(QStringLiteral("Screen:")));
|
|
||||||
}
|
|
||||||
|
|
||||||
QTEST_MAIN(TestMainWindow)
|
|
||||||
|
|
||||||
#include "test_main.moc"
|
|
||||||
Reference in new issue
Block a user