summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-05-06 14:48:46 -0700
committerQt by Nokia <qt-info@nokia.com>2012-05-07 05:03:17 +0200
commitf28ba2be974eab5397f6b9d554c3a56b01fed33c (patch)
treeeb7d8bf078e6060bfa49d093d5aa28e7f614c84d /tests/auto
parentd0e7014429ff40b535a07801679f5fc66cf7cf12 (diff)
Fix encoding mismatches in tst_QSqlQuery
The file has been UTF-8 encoded for years, which means that the line: QString longerBLOB( "abcdefghijklmnopqrstuvxyz¿äëïöü¡ " ); Loaded a mojibake into QString. Then, this data was stored as a blob in the database by calling longerBLOB.toLatin1() (a QByteArray), and reloaded for check using toString(). Once the QString default codec changes to UTF-8, the mojibake would get fixed, and the test would fail. Make sure it doesn't happen. Change-Id: If12d6124c973e4a1c1b7978d90fffb9aa5545c66 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index f5cc8d3b02..b5fb36a62b 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -2712,11 +2712,11 @@ void tst_QSqlQuery::blobsPreparedQuery()
QVERIFY_SQL( q, exec( QString( "CREATE TABLE %1(id INTEGER, data %2)" ).arg( tableName ).arg( typeName ) ) );
q.prepare( QString( "INSERT INTO %1(id, data) VALUES(:id, :data)" ).arg( tableName ) );
q.bindValue( ":id", 1 );
- q.bindValue( ":data", shortBLOB.toLatin1() );
+ q.bindValue( ":data", shortBLOB );
QVERIFY_SQL( q, exec() );
q.bindValue( ":id", 2 );
- q.bindValue( ":data", longerBLOB.toLatin1() );
+ q.bindValue( ":data", longerBLOB );
QVERIFY_SQL( q, exec() );
// Two executions and result sets
@@ -2729,7 +2729,7 @@ void tst_QSqlQuery::blobsPreparedQuery()
q.bindValue( 0, QVariant( 2 ) );
QVERIFY_SQL( q, exec() );
QVERIFY_SQL( q, next() );
- QCOMPARE( q.value( 0 ).toString(), longerBLOB );
+ QCOMPARE( q.value( 0 ).toString().toUtf8(), longerBLOB.toUtf8() );
// Only one execution and result set
q.prepare( QString( "SELECT id, data FROM %1 ORDER BY id" ).arg( tableName ) );