diff options
author | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-07-07 11:32:13 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@theqtcompany.com> | 2015-07-10 08:54:06 +0000 |
commit | 38799ceaf111fb44665c1dd0e33896120d175ebc (patch) | |
tree | 7c3215dad4ec9f8962c44f2a915ba7809859cf45 /tests | |
parent | 39a56f719a24a75e303d3a34f73a9c8cb1a01a34 (diff) |
Make use of the new varadic template feature + cosmetic changes.
Change constructor to take the a package manager argument. Add a
package manager member to the operation. Remove setter function.
Change-Id: Iffb860e24089beb6496ac4ee479d547a29463728
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'tests')
6 files changed, 26 insertions, 28 deletions
diff --git a/tests/auto/installer/binaryformat/tst_binaryformat.cpp b/tests/auto/installer/binaryformat/tst_binaryformat.cpp index 31663158e..7402f05f2 100644 --- a/tests/auto/installer/binaryformat/tst_binaryformat.cpp +++ b/tests/auto/installer/binaryformat/tst_binaryformat.cpp @@ -57,7 +57,9 @@ struct Layout : public QInstaller::BinaryLayout class TestOperation : public KDUpdater::UpdateOperation { public: - TestOperation(const QString &name) { setName(name); } + TestOperation(const QString &name) + : KDUpdater::UpdateOperation(0) + { setName(name); } virtual void backup() {} virtual bool performOperation() { return true; } diff --git a/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp b/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp index c0f250435..1322303ff 100644 --- a/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp +++ b/tests/auto/installer/consumeoutputoperationtest/tst_consumeoutputoperationtest.cpp @@ -68,7 +68,7 @@ private slots: void testMissingArguments() { - ConsumeOutputOperation operation; + ConsumeOutputOperation operation(0); QVERIFY(operation.testOperation()); QVERIFY(!operation.performOperation()); @@ -89,8 +89,7 @@ private slots: { QString testOutput = getOutputFrom(QUOTE(QMAKE_BINARY), QStringList("-query")); - ConsumeOutputOperation operation; - operation.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core)); + ConsumeOutputOperation operation(&m_core); operation.setArguments(QStringList() << "testConsumeOutputKey" << QUOTE(QMAKE_BINARY) << "-query"); QVERIFY2(operation.performOperation(), qPrintable(operation.errorString())); diff --git a/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp b/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp index c344fb8e1..be5705298 100644 --- a/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp +++ b/tests/auto/installer/extractarchiveoperationtest/tst_extractarchiveoperationtest.cpp @@ -54,7 +54,7 @@ private slots: void testMissingArguments() { - ExtractArchiveOperation op; + ExtractArchiveOperation op(0); QVERIFY(op.testOperation()); QVERIFY(!op.performOperation()); @@ -68,7 +68,7 @@ private slots: void testExtractOperationValidFile() { - ExtractArchiveOperation op; + ExtractArchiveOperation op(0); op.setArguments(QStringList() << ":///data/valid.7z" << QDir::tempPath()); QVERIFY(op.testOperation()); @@ -78,7 +78,7 @@ private slots: void testExtractOperationInvalidFile() { - ExtractArchiveOperation op; + ExtractArchiveOperation op(0); op.setArguments(QStringList() << ":///data/invalid.7z" << QDir::tempPath()); QVERIFY(op.testOperation()); diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp index 5feb64c93..583bb26f0 100644 --- a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp +++ b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp @@ -15,8 +15,7 @@ class tst_FakeStopProcessForUpdateOperation : public QObject private slots: void testMissingArgument() { - FakeStopProcessForUpdateOperation op; - op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core)); + FakeStopProcessForUpdateOperation op(&m_core); QVERIFY(op.testOperation()); QVERIFY(op.performOperation()); @@ -29,7 +28,7 @@ private slots: void testMissingPackageManagerCore() { - FakeStopProcessForUpdateOperation op; + FakeStopProcessForUpdateOperation op(0); op.setArguments(QStringList() << QFileInfo(QCoreApplication::applicationFilePath()).fileName()); QVERIFY(op.testOperation()); @@ -44,9 +43,8 @@ private slots: { const QString app = QFileInfo(QCoreApplication::applicationFilePath()).fileName(); - FakeStopProcessForUpdateOperation op; + FakeStopProcessForUpdateOperation op(&m_core); op.setArguments(QStringList() << app); - op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core)); QVERIFY(op.testOperation()); QVERIFY(op.performOperation()); @@ -59,9 +57,8 @@ private slots: void testRunningNonApplication() { - FakeStopProcessForUpdateOperation op; + FakeStopProcessForUpdateOperation op(&m_core); op.setArguments(QStringList() << "dummy.exe"); - op.setValue(QLatin1String("installer"), QVariant::fromValue(&m_core)); QVERIFY(op.testOperation()); QVERIFY(op.performOperation()); diff --git a/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp b/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp index 774226dca..f7c05b7a1 100644 --- a/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp +++ b/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp @@ -66,7 +66,7 @@ private slots: void testWrongArguments() { - SettingsOperation noArgumentsOperation; + SettingsOperation noArgumentsOperation(0); QVERIFY(noArgumentsOperation.testOperation()); @@ -82,7 +82,7 @@ private slots: // same for undo QCOMPARE(noArgumentsOperation.undoOperation(), false); - SettingsOperation wrongMethodArgumentOperation; + SettingsOperation wrongMethodArgumentOperation(0); wrongMethodArgumentOperation.setArguments(QStringList() << "path=first" << "method=second" << "key=third" << "value=fourth"); @@ -115,7 +115,7 @@ private slots: testSettings.setValue(key, value); } - SettingsOperation settingsOperation; + SettingsOperation settingsOperation(0); settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << "method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value)); settingsOperation.backup(); @@ -133,7 +133,7 @@ private slots: const QString key = "key"; const QString value = "value"; - SettingsOperation settingsOperation; + SettingsOperation settingsOperation(0); settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << "method=set" << QString("key=%1").arg(key) << QString("value=%1").arg(value)); settingsOperation.backup(); @@ -160,7 +160,7 @@ private slots: } QCOMPARE(testValueString.isEmpty(), false); - SettingsOperation settingsOperation; + SettingsOperation settingsOperation(0); settingsOperation.setArguments(QStringList() << QString("path=%1").arg(testFilePath) << "method=remove" << QString("key=%1").arg(key)); settingsOperation.backup(); @@ -195,10 +195,10 @@ private slots: testFile.close(); QMap<QString, SettingsOperation*> testSettingsOperationMap; - testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation; - testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation; - testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation; - testSettingsOperationMap["testcategory/categoryarrayvalue4"] = new SettingsOperation; + testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(0); + testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(0); + testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(0); + testSettingsOperationMap["testcategory/categoryarrayvalue4"] = new SettingsOperation(0); QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin(); while (i != testSettingsOperationMap.end()) { @@ -262,9 +262,9 @@ private slots: testFile.close(); QMap<QString, SettingsOperation*> testSettingsOperationMap; - testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation; - testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation; - testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation; + testSettingsOperationMap["testcategory/categoryarrayvalue1"] = new SettingsOperation(0); + testSettingsOperationMap["testcategory/categoryarrayvalue2"] = new SettingsOperation(0); + testSettingsOperationMap["testcategory/categoryarrayvalue3"] = new SettingsOperation(0); QMap<QString, SettingsOperation*>::iterator i = testSettingsOperationMap.begin(); while (i != testSettingsOperationMap.end()) { diff --git a/tests/environmentvariable/environmentvariabletest.cpp b/tests/environmentvariable/environmentvariabletest.cpp index d82098680..5d0f4672e 100644 --- a/tests/environmentvariable/environmentvariabletest.cpp +++ b/tests/environmentvariable/environmentvariabletest.cpp @@ -55,7 +55,7 @@ void EnvironmentVariableTest::testPersistentNonSystem() #endif QString key = QLatin1String("IFW_TestKey"); QString value = QLatin1String("IFW_TestValue"); - QInstaller::EnvironmentVariableOperation op; + QInstaller::EnvironmentVariableOperation op(0); op.setArguments( QStringList() << key << value << QLatin1String("true") @@ -83,7 +83,7 @@ void EnvironmentVariableTest::testNonPersistentNonSystem() #endif QString key = QLatin1String("IFW_TestKey"); QString value = QLatin1String("IFW_TestValue"); - QInstaller::EnvironmentVariableOperation op; + QInstaller::EnvironmentVariableOperation op(0); op.setArguments( QStringList() << key << value << QLatin1String("false") |