qt-migration-copilot-demo/pipeline/pr-main There was a failure building this commit
Replace u""_s with QStringLiteral() for compiler compatibility Entire-Checkpoint: 7fd5c52cf858
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include "MainWindow.h"
|
|
|
|
#include <QApplication>
|
|
#include <QtTest/QtTest>
|
|
|
|
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(), QStringLiteral("Qt6 Legacy Migration Benchmark"));
|
|
}
|
|
|
|
void TestMainWindowWidget::testValidateInputMethod()
|
|
{
|
|
MainWindow window;
|
|
|
|
QVERIFY(window.validateInput(QStringLiteral("Test123")));
|
|
QVERIFY(window.validateInput(QStringLiteral("abc456")));
|
|
QVERIFY(!window.validateInput(QStringLiteral("123Test")));
|
|
QVERIFY(!window.validateInput(QStringLiteral("")));
|
|
}
|
|
|
|
void TestMainWindowWidget::testGetScreenInfo()
|
|
{
|
|
MainWindow window;
|
|
QString info = window.getScreenInfo();
|
|
QVERIFY(!info.isEmpty());
|
|
QVERIFY(info.contains(QStringLiteral("Screen:")));
|
|
}
|
|
|
|
QTEST_MAIN(TestMainWindowWidget)
|
|
|
|
#include "test_mainwindow.moc" |