data/test/cpp/a22f594b97679a06129baec831bbca7d3118a1c8tst_qfavoriteservicesmodel.cpp
void tst_QFavoriteServicesModel::modelTest()
{
    QtopiaServiceDescription a(QtopiaServiceDescription(QtopiaServiceRequest("a","a"),"a","a2"));
    QtopiaServiceDescription b(QtopiaServiceDescription(QtopiaServiceRequest("b","b"),"b","b2"));
    QFavoriteServicesModel model;
    model.insert(QModelIndex(),a);
    model.insert(QModelIndex(),b);
    QSpeedDial::set("1",a);

    QCOMPARE(model.rowCount(),2);
    QCOMPARE(model.description(model.index(0)),a);
    QCOMPARE(model.indexOf(a).row(),0);
    QCOMPARE(model.data(model.index(0),Qt::DisplayRole).toString(),QString("a"));
    QCOMPARE(model.description(model.index(1)),b);
    QCOMPARE(model.indexOf(b).row(),1);
    QCOMPARE(model.data(model.index(1),Qt::DisplayRole).toString(),QString("b"));
    QCOMPARE(model.speedDialInput(model.index(0)),QString("1"));
    QCOMPARE(model.data(model.index(0),QFavoriteServicesModel::SpeedDialInputRole).toString(),QString("1"));
    QCOMPARE(model.data(model.index(1),QFavoriteServicesModel::SpeedDialInputRole).toString(),QString(""));
}
/*!
  Tests the QFavoriteServicesModel model functions,
  including rowCount and data. Also speedDialInput
  and description, very similar to the data functions.
  It also tests indexOf(QtopiaServiceDescription)
*/
Tests the QFavoriteServicesModel model functions,
including rowCount and data. Also speedDialInput
and description, very similar to the data functions.
Tests the QFavoriteServicesModel model functions including rowCount and data . Also speedDialInput and description very similar to the data functions .
void tst_QFavoriteServicesModel::modelTest()
{
    QtopiaServiceDescription a(QtopiaServiceDescription(QtopiaServiceRequest("a","a"),"a","a2"));
    QtopiaServiceDescription b(QtopiaServiceDescription(QtopiaServiceRequest("b","b"),"b","b2"));
    QFavoriteServicesModel model;
    model.insert(QModelIndex(),a);
    model.insert(QModelIndex(),b);
    QSpeedDial::set("1",a);
    QCOMPARE(model.rowCount(),2);
    QCOMPARE(model.description(model.index(0)),a);
    QCOMPARE(model.indexOf(a).row(),0);
    QCOMPARE(model.data(model.index(0),Qt::DisplayRole).toString(),QString("a"));
    QCOMPARE(model.description(model.index(1)),b);
    QCOMPARE(model.indexOf(b).row(),1);
    QCOMPARE(model.data(model.index(1),Qt::DisplayRole).toString(),QString("b"));
    QCOMPARE(model.speedDialInput(model.index(0)),QString("1"));
    QCOMPARE(model.data(model.index(0),QFavoriteServicesModel::SpeedDialInputRole).toString(),QString("1"));
    QCOMPARE(model.data(model.index(1),QFavoriteServicesModel::SpeedDialInputRole).toString(),QString(""));
}
void tst_QFavoriteServicesModel :: modelTest ( ) { QtopiaServiceDescription a ( QtopiaServiceDescription ( QtopiaServiceRequest ( " " , " " ) , " " , " " ) ) ; QtopiaServiceDescription b ( QtopiaServiceDescription ( QtopiaServiceRequest ( " " , " " ) , " " , " " ) ) ; QFavoriteServicesModel model ; model . insert ( QModelIndex ( ) , a ) ; model . insert ( QModelIndex ( ) , b ) ; QSpeedDial :: set ( " " , a ) ; QCOMPARE ( model . rowCount ( ) , 2 ) ; QCOMPARE ( model . description ( model . index ( 0 ) ) , a ) ; QCOMPARE ( model . indexOf ( a ) . row ( ) , 0 ) ; QCOMPARE ( model . data ( model . index ( 0 ) , Qt :: DisplayRole ) . toString ( ) , QString ( " " ) ) ; QCOMPARE ( model . description ( model . index ( 1 ) ) , b ) ; QCOMPARE ( model . indexOf ( b ) . row ( ) , 1 ) ; QCOMPARE ( model . data ( model . index ( 1 ) , Qt :: DisplayRole ) . toString ( ) , QString ( " " ) ) ; QCOMPARE ( model . speedDialInput ( model . index ( 0 ) ) , QString ( " " ) ) ; QCOMPARE ( model . data ( model . index ( 0 ) , QFavoriteServicesModel :: SpeedDialInputRole ) . toString ( ) , QString ( " " ) ) ; QCOMPARE ( model . data ( model . index ( 1 ) , QFavoriteServicesModel :: SpeedDialInputRole ) . toString ( ) , QString ( " " ) ) ; }
Tests the QFavoriteServicesModel model functions,
including rowCount and data.
Tests the QFavoriteServicesModel model functions including rowCount and data .