Less Qt in strmrun test

This commit is contained in:
Matthias Koefferlein 2018-07-04 20:30:34 +02:00
parent ad7a9836b0
commit eec1843459
1 changed files with 6 additions and 21 deletions

View File

@ -21,34 +21,19 @@
*/ */
#include "tlUnitTest.h" #include "tlUnitTest.h"
#include "tlStream.h"
#if defined(HAVE_QT)
# include <QProcess>
# include <QStringList>
#endif
// Testing the converter main implementation (CIF) // Testing the converter main implementation (CIF)
TEST(1) TEST(1)
{ {
// TODO: provide a Qt-less way of running these tests
#if defined(HAVE_QT)
QProcess process;
process.setProcessChannelMode (QProcess::MergedChannels);
QStringList args;
std::string fp (tl::testsrc ()); std::string fp (tl::testsrc ());
fp += "/testdata/bd/strmrun.py"; fp += "/testdata/bd/strmrun.py";
args << tl::to_qstring (fp);
process.start (tl::to_qstring ("./strmrun"), args); std::string path = "./strmrun " + fp;
bool success = process.waitForFinished (-1); tl::InputPipe pipe (path);
tl::InputStream is (pipe);
std::string data = is.read_all ();
QByteArray ba = process.readAll (); EXPECT_EQ (data, "Hello, world (0,-42;42,0)!\n");
EXPECT_EQ (ba.constData (), "Hello, world (0,-42;42,0)!\n");
EXPECT_EQ (success, true);
#else
EXPECT_EQ (true, false);
#endif
} }