Changeset View
Changeset View
Standalone View
Standalone View
autotests/kservicetest.cpp
Show First 20 Lines • Show All 893 Lines • ▼ Show 20 Line(s) | |||||
894 | 894 | | |||
895 | void KServiceTest::testEntryPathToName() | 895 | void KServiceTest::testEntryPathToName() | ||
896 | { | 896 | { | ||
897 | QCOMPARE(KService(QStringLiteral("c.desktop")).name(), QStringLiteral("c")); | 897 | QCOMPARE(KService(QStringLiteral("c.desktop")).name(), QStringLiteral("c")); | ||
898 | QCOMPARE(KService(QStringLiteral("a.b.c.desktop")).name(), QStringLiteral("a.b.c")); // dots in filename before .desktop extension | 898 | QCOMPARE(KService(QStringLiteral("a.b.c.desktop")).name(), QStringLiteral("a.b.c")); // dots in filename before .desktop extension | ||
899 | QCOMPARE(KService(QStringLiteral("/hallo/a.b.c.desktop")).name(), QStringLiteral("a.b.c")); | 899 | QCOMPARE(KService(QStringLiteral("/hallo/a.b.c.desktop")).name(), QStringLiteral("a.b.c")); | ||
900 | } | 900 | } | ||
901 | 901 | | |||
902 | #if KSERVICE_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
902 | void KServiceTest::testKPluginMetaData() | 903 | void KServiceTest::testKPluginMetaData() | ||
903 | { | 904 | { | ||
904 | const QString fakePart = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/") + "fakepart.desktop"; | 905 | const QString fakePart = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/") + "fakepart.desktop"; | ||
905 | KPluginMetaData md(fakePart); | 906 | KPluginMetaData md(fakePart); | ||
906 | KService::Ptr service(new KService(fakePart)); | 907 | KService::Ptr service(new KService(fakePart)); | ||
907 | KPluginInfo info(service); | 908 | KPluginInfo info(service); | ||
908 | auto info_md = info.toMetaData(); | 909 | auto info_md = info.toMetaData(); | ||
909 | QCOMPARE(info_md.formFactors(), md.formFactors()); | 910 | QCOMPARE(info_md.formFactors(), md.formFactors()); | ||
910 | } | 911 | } | ||
912 | #endif | ||||
911 | 913 | | |||
912 | void KServiceTest::testTraderQueryMustRebuildSycoca() | 914 | void KServiceTest::testTraderQueryMustRebuildSycoca() | ||
913 | { | 915 | { | ||
914 | QVERIFY(!KServiceTypeProfile::hasProfile(QStringLiteral("FakeBasePart"))); | 916 | QVERIFY(!KServiceTypeProfile::hasProfile(QStringLiteral("FakeBasePart"))); | ||
915 | QTest::qWait(1000); | 917 | QTest::qWait(1000); | ||
916 | createFakeService(QStringLiteral("fakeservice_querymustrebuild.desktop"), QString()); // just to touch the dir | 918 | createFakeService(QStringLiteral("fakeservice_querymustrebuild.desktop"), QString()); // just to touch the dir | ||
917 | KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("FakeBasePart")); | 919 | KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("FakeBasePart")); | ||
918 | QVERIFY(offers.count() > 0); | 920 | QVERIFY(offers.count() > 0); | ||
919 | } | 921 | } |