diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2011-09-23 15:27:43 +1000 |
---|---|---|
committer | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2011-10-10 09:25:31 +1000 |
commit | 2041b29be9d16f07da9d09390322b28ead9e534f (patch) | |
tree | a159537bcb3dc7ea6827b4caaed46265dceb8766 | |
parent | 4a30e784182a41d54d8b908ba47d948ed4172236 (diff) |
Remove debugging statements, use QCOMPARE
QCOMPARE ensures that failures are reported more clearly.
Change-Id: Iff2ce4550c546f40ff2dd420a4440b79ecdf61a4
Fixes: MTMW-339
Reviewed-on: http://codereview.qt-project.org/5436
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
-rw-r--r-- | tests/auto/sensors2qmlapi/tst_sensors2qmlapi.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/tests/auto/sensors2qmlapi/tst_sensors2qmlapi.cpp b/tests/auto/sensors2qmlapi/tst_sensors2qmlapi.cpp index 129dc963..c9ec4d0b 100644 --- a/tests/auto/sensors2qmlapi/tst_sensors2qmlapi.cpp +++ b/tests/auto/sensors2qmlapi/tst_sensors2qmlapi.cpp @@ -93,15 +93,17 @@ void tst_Sensors2QMLAPI::testProximity() TestSensorPlugin plugin; QDeclProximitySensor* proxi = plugin.stProxi; - qDebug() << "Check close = true"; proxi->test(true); - QVERIFY((bool)prox.property("close").toBool() == true); + bool expected = true; + bool actual = prox.property("close").toBool(); + QCOMPARE(expected, actual); - qDebug() << "Check close = false"; QSignalSpy spy1(&prox, SIGNAL(closeChanged())); proxi->test(false); QCOMPARE(spy1.count() , 1); - QVERIFY((bool)prox.property("close").toBool() == false); + expected = false; + actual = prox.property("close").toBool(); + QCOMPARE(expected, actual); spy1.clear(); proxi->test(false); @@ -124,21 +126,13 @@ void tst_Sensors2QMLAPI::testAmbientLight() QDeclAmbientLightSensor* abl = plugin.stAbl; for (int en = 5; en >= 0; en--){ - QString enumname = ""; - switch (en) - { - case 0: enumname = "Undefined"; break; - case 1: enumname = "Dark"; break; - case 2: enumname = "Twilight"; break; - case 3: enumname = "Light"; break; - case 4: enumname = "Bright"; break; - case 5: enumname = "Sunny"; break; - } - qDebug() << "Check " << enumname; QSignalSpy spy1(&als, SIGNAL(lightLevelChanged())); abl->test((QSensor2AmbientLight::LightLevel)en); QCOMPARE(spy1.count() , 1); - QVERIFY((int)als.property("lightLevel").toInt() == en); + int expected = en; + int actual = als.property("lightLevel").toInt(); + if (expected != actual) + QCOMPARE(expected, actual); spy1.clear(); abl->test((QSensor2AmbientLight::LightLevel)en); @@ -258,9 +252,7 @@ void tst_Sensors2QMLAPI::testTilt() void tst_Sensors2QMLAPI::testTilt_receivedSignalsCount() { - qDebug() << "Check xRotation changed: " << xrotch; QCOMPARE(xrotch , 9); - qDebug() << "Check yRotation changed: " << yrotch; QCOMPARE(yrotch , 23); } |