qtmobility/tests/auto/qcontactactions/unittest/tst_qcontactactions.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    65     void init();
    65     void init();
    66     void cleanup();
    66     void cleanup();
    67 private slots:
    67 private slots:
    68     void testSendEmail();
    68     void testSendEmail();
    69     void testDescriptor();
    69     void testDescriptor();
       
    70     void testDescriptorLessThan();
       
    71     void testDescriptorHash();
    70     void traits();
    72     void traits();
    71 };
    73 };
    72 
    74 
    73 /* Test a static factory as well */
    75 /* Test a static factory as well */
    74 class DummyStaticActionFactory : public QContactActionFactory
    76 class DummyStaticActionFactory : public QContactActionFactory
   312     //QVERIFY(!sendEmail->metadata().isNull());
   314     //QVERIFY(!sendEmail->metadata().isNull());
   313     QVERIFY(!sendEmail->actionDescriptor().vendorName().isEmpty());
   315     QVERIFY(!sendEmail->actionDescriptor().vendorName().isEmpty());
   314     QVERIFY(sendEmail->actionDescriptor().implementationVersion() != -1);
   316     QVERIFY(sendEmail->actionDescriptor().implementationVersion() != -1);
   315     QVERIFY(sendEmail->actionDescriptor().implementationVersion() != 0);
   317     QVERIFY(sendEmail->actionDescriptor().implementationVersion() != 0);
   316     //QVERIFY(!sendEmail->contactFilter().isEmpty());
   318     //QVERIFY(!sendEmail->contactFilter().isEmpty());
   317     QVERIFY(sendEmail->supportsDetail(e));
   319     QVERIFY(sendEmail->isDetailSupported(e));
   318     QVERIFY(sendEmail->supportedDetails(c).contains(e));
   320     QVERIFY(sendEmail->supportedDetails(c).contains(e));
   319     //QVERIFY(sendEmail->performAction(c, e));
   321     //QVERIFY(sendEmail->performAction(c, e));
   320     //QVERIFY(sendEmail->performAction(c));
   322     //QVERIFY(sendEmail->performAction(c));
   321 
   323 
   322     delete sendEmail;
   324     delete sendEmail;
   404 
   406 
   405     QVERIFY(sendEmailAction3->actionDescriptor() == sendEmailDescriptor);
   407     QVERIFY(sendEmailAction3->actionDescriptor() == sendEmailDescriptor);
   406     delete sendEmailAction3;
   408     delete sendEmailAction3;
   407 }
   409 }
   408 
   410 
       
   411 void tst_QContactActions::testDescriptorLessThan()
       
   412 {
       
   413     QContactActionDescriptor qcad1;
       
   414     qcad1.setVendorName("a");
       
   415     qcad1.setActionName("a");
       
   416     qcad1.setImplementationVersion(1);
       
   417 
       
   418     QContactActionDescriptor qcad2;
       
   419     qcad2.setVendorName("a");
       
   420     qcad2.setActionName("a");
       
   421     qcad2.setImplementationVersion(2);
       
   422 
       
   423     QContactActionDescriptor qcad3;
       
   424     qcad3.setVendorName("a");
       
   425     qcad3.setActionName("b");
       
   426     qcad3.setImplementationVersion(1);
       
   427 
       
   428     QContactActionDescriptor qcad4;
       
   429     qcad4.setVendorName("b");
       
   430     qcad4.setActionName("a");
       
   431     qcad4.setImplementationVersion(1);
       
   432 
       
   433     QVERIFY(qcad1 < qcad2);
       
   434     QVERIFY(qcad2 < qcad3);
       
   435     QVERIFY(qcad3 < qcad4);
       
   436 }
       
   437 
       
   438 void tst_QContactActions::testDescriptorHash()
       
   439 {
       
   440     QContactActionDescriptor qcad1;
       
   441     qcad1.setVendorName("a");
       
   442     qcad1.setActionName("a");
       
   443     qcad1.setImplementationVersion(1);
       
   444 
       
   445     QContactActionDescriptor qcad2;
       
   446     qcad2.setVendorName("a");
       
   447     qcad2.setActionName("a");
       
   448     qcad2.setImplementationVersion(1);
       
   449 
       
   450     QContactActionDescriptor qcad3;
       
   451     qcad3.setVendorName("a");
       
   452     qcad3.setActionName("a");
       
   453     qcad3.setImplementationVersion(2);
       
   454 
       
   455     QVERIFY(qHash(qcad1) == qHash(qcad2));
       
   456     QVERIFY(qHash(qcad1) != qHash(qcad3));
       
   457 }
       
   458 
   409 void tst_QContactActions::traits()
   459 void tst_QContactActions::traits()
   410 {
   460 {
   411     QCOMPARE(sizeof(QContactActionDescriptor), sizeof(void *));
   461     QCOMPARE(sizeof(QContactActionDescriptor), sizeof(void *));
   412     QTypeInfo<QTM_PREPEND_NAMESPACE(QContactActionDescriptor)> ti;
   462     QTypeInfo<QTM_PREPEND_NAMESPACE(QContactActionDescriptor)> ti;
   413     QVERIFY(ti.isComplex);
   463     QVERIFY(ti.isComplex);