From d328dd6ac7250c4453ff2dc5d8c9c13ac3b236bc Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 7 Nov 2017 13:47:01 +0300 Subject: Fix the result of KDesktopFile::sortOrder() Summary: KDesktopFile::sortOrder() returns the value of SortOrder key as a string whithout parsing it as a list. But according to Desktop Entry Specification https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html it's type is "string(s)", i.e. the same type as the type of Actions and MimeType keys, and thus it should be read the same way. Reviewers: #frameworks, dfaure Reviewed By: dfaure Subscribers: dfaure, #frameworks Tags: #frameworks Differential Revision: https://phabricator.kde.org/D8689 --- autotests/kdesktopfiletest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'autotests/kdesktopfiletest.cpp') diff --git a/autotests/kdesktopfiletest.cpp b/autotests/kdesktopfiletest.cpp index 66fc8827..d0a0a262 100644 --- a/autotests/kdesktopfiletest.cpp +++ b/autotests/kdesktopfiletest.cpp @@ -62,6 +62,25 @@ void KDesktopFileTest::testRead() QCOMPARE(df.fileName(), QFileInfo(fileName).canonicalFilePath()); } +void KDesktopFileTest::testReadDirectory() +{ + QTemporaryFile file("testReadDirectoryXXXXXX.directory"); + QVERIFY(file.open()); + const QString fileName = file.fileName(); + QTextStream ts(&file); + ts << + "[Desktop Entry]\n" + "Type=Directory\n" + "SortOrder=2.desktop;1.desktop;\n" + "\n"; + file.close(); + QVERIFY(QFile::exists(fileName)); + KDesktopFile df(fileName); + QCOMPARE(df.readType(), QString::fromLatin1("Directory")); + QCOMPARE(df.sortOrder(), QStringList() << QString::fromLatin1("2.desktop") + << QString::fromLatin1("1.desktop")); +} + void KDesktopFileTest::testReadLocalized_data() { QTest::addColumn("locale"); -- cgit v1.2.1