Ejemplo n.º 1
0
void KMimeTypeTest::testHasServiceType2() // with services coming from ksycoca
{
    KService::Ptr faketextpart = KService::serviceByDesktopPath("faketextpart.desktop");
    QVERIFY(faketextpart);
    QVERIFY(faketextpart->hasMimeType("text/plain"));
    QVERIFY(faketextpart->hasMimeType("text/x-patch"));     // due to inheritance
    QVERIFY(!faketextpart->hasMimeType("image/png"));
    QVERIFY(faketextpart->hasServiceType("KParts/ReadOnlyPart"));
    QVERIFY(!faketextpart->hasServiceType("KParts/ReadWritePart"));
    QVERIFY(!faketextpart->hasServiceType("KPluginInfo"));

    KService::Ptr textPlugin = KService::serviceByDesktopPath("faketextplugin.desktop");
    QVERIFY(textPlugin);
    QVERIFY(textPlugin->hasServiceType("KPluginInfo"));
    QVERIFY(!textPlugin->hasServiceType("KParts/ReadOnlyPart"));
}
Ejemplo n.º 2
0
void KMimeTypeTest::testHasServiceType2() // with services coming from ksycoca
{
    KService::Ptr katepart = KService::serviceByDesktopPath( "katepart.desktop" );
    QVERIFY( !katepart.isNull() );
    QVERIFY( katepart->hasMimeType( "text/plain" ) );
    QVERIFY( katepart->hasMimeType( "text/x-patch" ) ); // due to inheritance
    QVERIFY( !katepart->hasMimeType( "image/png" ) );
    QVERIFY( katepart->hasServiceType( "KParts/ReadOnlyPart" ) );
    QVERIFY( katepart->hasServiceType( "KParts/ReadWritePart" ) );
    QVERIFY( !katepart->hasServiceType( "KTextEditor/Plugin" ) );

    KService::Ptr ktexteditor_insertfile = KService::serviceByDesktopPath( "ktexteditor_insertfile.desktop" );
    QVERIFY( !ktexteditor_insertfile.isNull() );
    QVERIFY( ktexteditor_insertfile->hasServiceType( "KTextEditor/Plugin" ) );
    QVERIFY( !ktexteditor_insertfile->hasServiceType( "KParts/ReadOnlyPart" ) );
}