diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-13 16:38:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-14 08:32:42 +0000 |
commit | f0a559f1c8dcf4b78c11853316919783823ded7a (patch) | |
tree | d5199ce97c70001b7db6cbba4082d8699c90abaf /tests/auto/sql | |
parent | a2a00eb044596f3e3f628b6b20b38a5ba524915c (diff) |
Tests: Use QCOMPARE() with QLatin1String() for QString values.
Prefer QCOMPARE over QVERIFY for equality and use QLatin1String().
Change-Id: If226a0fc7b25be3e6774c7e36ca1e6f99234e5dd
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/sql')
-rw-r--r-- | tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp | 16 | ||||
-rw-r--r-- | tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp index b77e1fe9ef..1d31f921f0 100644 --- a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp +++ b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp @@ -201,9 +201,9 @@ void tst_QSqlField::name() { QSqlField field( "test", QVariant::String ); QFETCH( QString, val ); - QVERIFY( field.name() == "test" ); + QCOMPARE(field.name(), QLatin1String("test")); field.setName( val ); - QVERIFY( field.name() == val ); + QCOMPARE(field.name(), val); } void tst_QSqlField::operator_Assign() @@ -253,9 +253,9 @@ void tst_QSqlField::setName() { QSqlField field( "test", QVariant::String ); QFETCH( QString, val ); - QVERIFY( field.name() == "test" ); + QCOMPARE(field.name(), QLatin1String("test")); field.setName( val ); - QVERIFY( field.name() == val ); + QCOMPARE(field.name(), val); } void tst_QSqlField::setNull() @@ -273,16 +273,16 @@ void tst_QSqlField::setReadOnly() field.setValue( "test" ); field.setReadOnly( true ); field.setValue( "Harry" ); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); field.clear(); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); QVERIFY( !field.isNull() ); field.clear(); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); QVERIFY( !field.isNull() ); field.setReadOnly( false ); field.setValue( "Harry" ); - QVERIFY( field.value() == "Harry" ); + QCOMPARE(field.value().toString(), QLatin1String("Harry")); field.clear(); QVERIFY( field.value() == QVariant().toString() ); QVERIFY( field.isNull() ); diff --git a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp index 8a90f16dce..722a391c13 100644 --- a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp +++ b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp @@ -484,7 +484,7 @@ void tst_QSqlRecord::setValue() QVERIFY( rec2.value( 3 ) == QVariant(bval) ); rec2.setValue( "string", "__Harry__" ); - QVERIFY( rec2.value( 0 ) == "__Harry__" ); + QCOMPARE(rec2.value(0).toString(), QLatin1String("__Harry__")); for ( i = 0; i < 4; ++i ) QVERIFY( !rec2.isNull( i ) ); @@ -501,7 +501,7 @@ void tst_QSqlRecord::value() QSqlRecord rec2; rec2.append( QSqlField( "string", QVariant::String ) ); rec2.setValue( "string", "Harry" ); - QVERIFY( rec2.value( "string" ) == "Harry" ); + QCOMPARE(rec2.value("string").toString(), QLatin1String("Harry")); } QTEST_MAIN(tst_QSqlRecord) |