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>
bb10
parent
d0e7014429
commit
f28ba2be97
|
|
@ -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 ) );
|
||||
|
|
|
|||
Loading…
Reference in New Issue