Files
qt-migration-copilot-demo/qt6-after/qt6-migrated-benchmark/tests/test_mainwindow.cpp
T
torsten c312c7ab31
qt-migration-copilot-demo/pipeline/pr-main There was a failure building this commit
Fix QString literals in test_mainwindow.cpp
Replace u""_s with QStringLiteral() for compiler compatibility

Entire-Checkpoint: 7fd5c52cf858
2026-10-22 18:45:30 +02:00

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"