summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>2011-12-22 15:44:28 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-25 20:16:55 +0100
commitfe089823bc36b7c1ea333cd57fb74541bafba1e4 (patch)
tree918afed46d7a3915db08ce2c8da9002a6cd5f168 /tests/auto
parent03b6cb93455475c7e36838e298cefa6f91c1eb6f (diff)
Build fix for tst_qprinter with c++11
GCC 4.6 fails to build the test because of narrowing conversion. Change-Id: I927693789be7f3df7bd1a96c8924fc04716a03f0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/painting/qprinter/tst_qprinter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
index 88c2a3ee9b..d7b0ccba21 100644
--- a/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
+++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp
@@ -975,7 +975,8 @@ void tst_QPrinter::testPdfTitle()
QPainter painter;
QPrinter printer;
// This string is just the UTF-8 encoding of the string: \()f &oslash; hiragana o
- const char title[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00};
+ const unsigned char titleBuf[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00};
+ const char *title = reinterpret_cast<const char*>(titleBuf);
printer.setOutputFileName("file.pdf");
printer.setDocName(QString::fromUtf8(title));
painter.begin(&printer);
@@ -986,10 +987,11 @@ void tst_QPrinter::testPdfTitle()
// The we expect the title to appear in the PDF as:
// ASCII('\title (') UTF16(\\\(\)f &oslash; hiragana o) ASCII(')').
// which has the following binary representation
- const char expected[] = {
+ const unsigned char expectedBuf[] = {
0x2f, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x20, 0x28, 0xfe,
0xff, 0x00, 0x5c, 0x5c, 0x00, 0x5c, 0x28, 0x00, 0x5c,
0x29, 0x00, 0x66, 0x00, 0xf8, 0x30, 0x4a, 0x29};
+ const char *expected = reinterpret_cast<const char*>(expectedBuf);
QVERIFY(file.readAll().contains(QByteArray(expected, 26)));
}