diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-10-27 12:25:11 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-10-27 12:25:11 +0100 |
commit | 65e13b70345b546c55b561ef490cce652f5534a3 (patch) | |
tree | ae411a526f8378f915bc08056d5d11c6a185fc64 /tests | |
parent | fefd72b293d080cfa05eeea27e359e9996dcd6b7 (diff) | |
download | qt-creator-65e13b70345b546c55b561ef490cce652f5534a3.tar.gz |
Debugger: Fix autotests on Windows
Format pointers consistently using 0x%[l]x in printf/scanf.
Remove %p formatting as the existence of the prefix 0x
is platform-dependent (missing with MSVC), which caused
a scanf error and thus dumper crash for QAbstractItem.
Reviewed-by: ck <qt-info@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 7dc603f664..eff6f97dbd 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -10,6 +10,12 @@ #include <QtTest/QtTest> //#include <QtTest/qtest_gui.h> +#if (QT_POINTER_SIZE==4) +# define POINTER_PRINTFORMAT "0x%x" +#else +# define POINTER_PRINTFORMAT "0x%lx" +#endif + #undef NS #ifdef QT_NAMESPACE # define STRINGIFY0(s) #s @@ -387,7 +393,7 @@ static void testDumper(QByteArray expected0, const void *data, QByteArray outert extraInt0, extraInt1, extraInt2, extraInt3); QString expected(expected0); char buf[100]; - sprintf(buf, "%p", data); + sprintf(buf, POINTER_PRINTFORMAT, (uintptr_t)data); if ((!expected.startsWith('t') && !expected.startsWith('f')) || expected.startsWith("type")) expected = "tiname='$I',addr='$A'," + expected; @@ -417,7 +423,7 @@ static void testDumper(QByteArray expected0, const void *data, QByteArray outert QByteArray str(const void *p) { char buf[100]; - sprintf(buf, "%p", p); + sprintf(buf, POINTER_PRINTFORMAT, (uintptr_t)p); return buf; } @@ -880,7 +886,7 @@ void tst_Debugger::dumpQByteArray() &ba, NS"QByteArray", true); // Case 5: Regular and special characters and the replacement character. - ba = QByteArray("abc\a\n\r\e\'\"?"); + ba = QByteArray("abc\a\n\r\033\'\"?"); testDumper("value='YWJjBwoNGyciPw==',valueencoded='1',type='"NS"QByteArray'," "numchild='10',childtype='char',childnumchild='0',children=[" "{value='61 (97 'a')'},{value='62 (98 'b')'}," |