Warning, file /pim/sink/tests/inspectiontest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #include <QTest> 0002 0003 #include <QString> 0004 0005 #include "store.h" 0006 #include "resourcecontrol.h" 0007 #include "resourceconfig.h" 0008 #include "resource.h" 0009 #include "log.h" 0010 #include "test.h" 0011 0012 /** 0013 * Test of inspection system using the dummy resource. 0014 * 0015 * This test requires the dummy resource installed. 0016 */ 0017 class InspectionTest : public QObject 0018 { 0019 Q_OBJECT 0020 private slots: 0021 void initTestCase() 0022 { 0023 auto factory = Sink::ResourceFactory::load("sink.dummy"); 0024 QVERIFY(factory); 0025 ResourceConfig::addResource("sink.dummy.instance1", "sink.dummy"); 0026 VERIFYEXEC(Sink::Store::removeDataFromDisk(QByteArray("sink.dummy.instance1"))); 0027 } 0028 0029 void testInspection_data() 0030 { 0031 QTest::addColumn<bool>("success"); 0032 QTest::newRow("success") << true; 0033 QTest::newRow("fail") << false; 0034 } 0035 0036 void testInspection() 0037 { 0038 QFETCH(bool, success); 0039 using namespace Sink; 0040 using namespace Sink::ApplicationDomain; 0041 0042 Mail mail(QByteArray("sink.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor>::create()); 0043 0044 // testInspection is a magic property that the dummyresource supports 0045 auto inspectionCommand = ResourceControl::Inspection::PropertyInspection(mail, "testInspection", success); 0046 auto result = ResourceControl::inspect<Mail>(inspectionCommand).exec(); 0047 result.waitForFinished(); 0048 if (success) { 0049 QVERIFY(!result.errorCode()); 0050 } else { 0051 QVERIFY(result.errorCode()); 0052 } 0053 } 0054 }; 0055 0056 QTEST_MAIN(InspectionTest) 0057 #include "inspectiontest.moc"