Fixed QTextStream "stdin" auto tests
On some platforms (like BlackBerry) qDebug doesn't write to stderr, so we directly write to stderr with fprintf. Change-Id: Ib86211c98cf4da1fa2dbea4600a78e2013dc1a5a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
cfb5dfb7e8
commit
983e921c54
@ -40,13 +40,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QDebug>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int, char**)
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
qDebug() << QTextStream(stdin).readAll();
|
||||
fprintf(stderr, "%s\n", QTextStream(stdin).readAll().toLatin1().constData());
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,17 +40,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int, char**)
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
QTextStream qin(stdin);
|
||||
if (!qin.atEnd()) {
|
||||
int a, b, c;
|
||||
qin >> a >> b >> c;
|
||||
qDebug("%d %d %d", a, b, c);
|
||||
fprintf(stderr, "%d %d %d\n", a, b, c);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1425,8 +1425,7 @@ void tst_QTextStream::readAllFromStdin()
|
||||
stdinProcess.closeWriteChannel();
|
||||
|
||||
QVERIFY(stdinProcess.waitForFinished(5000));
|
||||
QChar quoteChar('"');
|
||||
QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar));
|
||||
QCOMPARE(stream.readAll(), QString::fromLatin1("hello world\n"));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user