Exemplo n.º 1
0
void tst_QGeoAddress::emptyClearTest()
{
    QGeoAddress testObj;
    QVERIFY(testObj.isEmpty());

    testObj.setCountry(QLatin1String("country"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setCountryCode(QLatin1String("countryCode"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setState(QLatin1String("state"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setCounty(QLatin1String("county"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setCity(QLatin1String("city"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setDistrict(QLatin1String("district"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setPostalCode(QLatin1String("postalCode"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setStreet(QLatin1String("street"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    testObj.setText(QLatin1String("formatted address"));
    QVERIFY(!testObj.isEmpty());
    testObj.clear();

    QVERIFY(testObj.isEmpty());
}
Exemplo n.º 2
0
void tst_QGeoAddress::operators()
{
    //Create a copy and see that they are the same
    QGeoAddress *qgeoaddresscopy = new QGeoAddress (*qgeoaddress);
    QVERIFY(qgeoaddress->operator ==(*qgeoaddresscopy));
    QVERIFY(!qgeoaddress->operator !=(*qgeoaddresscopy));

    QFETCH(QString, country);
    QFETCH(QString, countryCode);
    QFETCH(QString, state);
    QFETCH(QString, county);
    QFETCH(QString, city);
    QFETCH(QString, postcode);
    QFETCH(QString, district);
    QFETCH(QString, street);

    qgeoaddress->setCountryCode(countryCode);
    qgeoaddress->setState(state);
    qgeoaddress->setCounty(county);
    qgeoaddress->setCity(city);
    qgeoaddress->setPostcode(postcode);
    qgeoaddress->setDistrict(district);
    qgeoaddress->setStreet(street);

    //After modifiying an address, test that they are different
    QVERIFY(!qgeoaddress->operator ==(*qgeoaddresscopy));
    QVERIFY(qgeoaddress->operator !=(*qgeoaddresscopy));

   // delete qgeoaddresscopy;

    //Assign one address to the other and test that they are the same again
    *qgeoaddresscopy = qgeoaddresscopy->operator =(*qgeoaddress);
    QVERIFY(qgeoaddress->operator ==(*qgeoaddresscopy));
    QVERIFY(!qgeoaddress->operator !=(*qgeoaddresscopy));

    //Clear one address and test that they are different
    qgeoaddresscopy->clear();
    QVERIFY(!qgeoaddress->operator ==(*qgeoaddresscopy));
    QVERIFY(qgeoaddress->operator !=(*qgeoaddresscopy));

    delete qgeoaddresscopy;

}