summaryrefslogtreecommitdiffstats
path: root/tests/auto/installer/createshortcutoperation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/installer/createshortcutoperation')
-rw-r--r--tests/auto/installer/createshortcutoperation/data/xmloperationrepository/A/1.0.2-1content.7zbin0 -> 185 bytes
-rw-r--r--tests/auto/installer/createshortcutoperation/data/xmloperationrepository/Updates.xml26
-rw-r--r--tests/auto/installer/createshortcutoperation/settings.qrc2
-rw-r--r--tests/auto/installer/createshortcutoperation/tst_createshortcutoperation.cpp46
4 files changed, 56 insertions, 18 deletions
diff --git a/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/A/1.0.2-1content.7z b/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/A/1.0.2-1content.7z
new file mode 100644
index 000000000..8ba90b13b
--- /dev/null
+++ b/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/A/1.0.2-1content.7z
Binary files differ
diff --git a/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/Updates.xml b/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/Updates.xml
new file mode 100644
index 000000000..a7d287d4d
--- /dev/null
+++ b/tests/auto/installer/createshortcutoperation/data/xmloperationrepository/Updates.xml
@@ -0,0 +1,26 @@
+<Updates>
+ <ApplicationName>{AnyApplication}</ApplicationName>
+ <ApplicationVersion>1.0.0</ApplicationVersion>
+ <Checksum>false</Checksum>
+ <PackageUpdate>
+ <Name>A</Name>
+ <DisplayName>A</DisplayName>
+ <Description>Example component A</Description>
+ <Version>1.0.2-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Default>true</Default>
+ <UpdateFile CompressedSize="225" UncompressedSize="75" OS="Any"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>6d7a3e15d11a4d94b81452fc2aa18e705a01c922</SHA1>
+ <Operations>
+ <Operation name="CreateShortcut">
+ <Argument>@TargetDir@/A.txt</Argument>
+ <Argument>@StartMenuDir@/A.lnk</Argument>
+ <Argument>workingDirectory=@TargetDir@</Argument>
+ <Argument>iconPath=%SystemRoot%/system32/SHELL32.dl</Argument>
+ <Argument>iconId=2</Argument>
+ <Argument>description=Open A file</Argument>
+ </Operation>
+ </Operations>
+ </PackageUpdate>
+</Updates>
diff --git a/tests/auto/installer/createshortcutoperation/settings.qrc b/tests/auto/installer/createshortcutoperation/settings.qrc
index 410fbf81a..d2365cab3 100644
--- a/tests/auto/installer/createshortcutoperation/settings.qrc
+++ b/tests/auto/installer/createshortcutoperation/settings.qrc
@@ -3,6 +3,8 @@
<file>data/repository/Updates.xml</file>
<file>data/repository/A/1.0.2-1content.7z</file>
<file>data/repository/A/1.0.2-1meta.7z</file>
+ <file>data/xmloperationrepository/Updates.xml</file>
+ <file>data/xmloperationrepository/A/1.0.2-1content.7z</file>
</qresource>
<qresource prefix="/metadata">
<file>installer-config/config.xml</file>
diff --git a/tests/auto/installer/createshortcutoperation/tst_createshortcutoperation.cpp b/tests/auto/installer/createshortcutoperation/tst_createshortcutoperation.cpp
index 19fbee0a9..a57098d2a 100644
--- a/tests/auto/installer/createshortcutoperation/tst_createshortcutoperation.cpp
+++ b/tests/auto/installer/createshortcutoperation/tst_createshortcutoperation.cpp
@@ -48,22 +48,8 @@ class tst_createshortcutoperation : public QObject
{
Q_OBJECT
-private slots:
- void testMissingArguments()
- {
- CreateShortcutOperation op;
-
- QVERIFY(op.testOperation());
- QVERIFY(!op.performOperation());
-
- QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::InvalidArguments);
- QCOMPARE(op.errorString(), QString("Invalid arguments in CreateShortcut: 0 arguments given,"
- " 2 or 3 arguments expected in the form: <target> <link location> "
- "[target arguments] [\"workingDirectory=...\"] [\"iconPath=...\"] "
- "[\"iconId=...\"] [\"description=...\"]."));
- }
-
- void testCreateShortcutForCurrentUserFromCLI()
+private:
+ void installFromCLI(const QString &repository)
{
QInstaller::init();
PackageManagerCore *core = new PackageManagerCore(BinaryContent::MagicInstallerMarker, QList<OperationBlob> (),
@@ -73,7 +59,7 @@ private slots:
core->disableWriteMaintenanceTool();
core->setAutoConfirmCommand();
QSet<Repository> repoList;
- Repository repo = Repository::fromUserInput(":///data/repository");
+ Repository repo = Repository::fromUserInput(repository);
repoList.insert(repo);
core->settings().setDefaultRepositories(repoList);
@@ -98,7 +84,31 @@ private slots:
core->commitSessionOperations();
core->uninstallComponentsSilently(QStringList() << "A");
QVERIFY(!QFile::exists(linkLocation));
- core->deleteLater();
+ }
+
+private slots:
+ void testMissingArguments()
+ {
+ CreateShortcutOperation op;
+
+ QVERIFY(op.testOperation());
+ QVERIFY(!op.performOperation());
+
+ QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::InvalidArguments);
+ QCOMPARE(op.errorString(), QString("Invalid arguments in CreateShortcut: 0 arguments given,"
+ " 2 or 3 arguments expected in the form: <target> <link location> "
+ "[target arguments] [\"workingDirectory=...\"] [\"iconPath=...\"] "
+ "[\"iconId=...\"] [\"description=...\"]."));
+ }
+
+ void testCreateShortcutFromScript()
+ {
+ installFromCLI(":///data/repository");
+ }
+
+ void testCreateShortcutFromXML()
+ {
+ installFromCLI(":///data/xmloperationrepository");
}
};