示例#1
0
void tst_MapType::constructorTest()
{
    QGeoMapType *testObjPtr = new QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("street map"),
                                              QStringLiteral("map description"), true, true, 1);
    QVERIFY(testObjPtr);
    QCOMPARE(testObjPtr->style(), QGeoMapType::StreetMap);
    QCOMPARE(testObjPtr->name(), QStringLiteral("street map"));
    QCOMPARE(testObjPtr->description(), QStringLiteral("map description"));
    QVERIFY(testObjPtr->mobile());
    QVERIFY(testObjPtr->night());
    QCOMPARE(testObjPtr->mapId(), 1);
    delete testObjPtr;

    testObjPtr = new QGeoMapType();
    QCOMPARE(testObjPtr->style(), QGeoMapType::NoMap);
    QVERIFY2(testObjPtr->name().isEmpty(), "Wrong default value");
    QVERIFY2(testObjPtr->description().isEmpty(), "Wrong default value");
    QVERIFY2(!testObjPtr->mobile(), "Wrong default value");
    QVERIFY2(!testObjPtr->night(), "Wrong default value");
    QCOMPARE(testObjPtr->mapId(), 0);
    delete testObjPtr;
}
void tst_MapType::constructorTest()
{
    QGeoMapType *testObjPtr = new QGeoMapType(QGeoMapType::StreetMap, "street name", "street desc", false, 0);
    QVERIFY(testObjPtr);
    delete testObjPtr;

    testObjPtr = new QGeoMapType();
    QVERIFY2(testObjPtr->style() == QGeoMapType::NoMap, "Wrong default value");
    QVERIFY2(testObjPtr->name() == "", "Wrong default value");
    QVERIFY2(testObjPtr->description() == "", "Wrong default value");
    QVERIFY2(testObjPtr->mobile() == false, "Wrong default value");
    QVERIFY2(testObjPtr->mapId() == 0, "Wrong default value");
    delete testObjPtr;
}
void tst_MapType::mobileTest()
{
    QGeoMapType testObj = QGeoMapType(QGeoMapType::StreetMap, "mobile street name", "mobile street desc", true, 0);
    QVERIFY2(testObj.mobile() == true, "Wrong value returned");
}