Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Jun 28, 2013
1 parent 492d55a commit 060b602
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,18 @@ QByteArray getClipboard(const QString &mime = QString("text/plain"))
return (data != NULL) ? data->data(mime) : QByteArray();
}

void initTestProcess(QProcess *p)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("COPYQ_TESTING", "1");
p->setProcessEnvironment(env);
}

int run(const Args &arguments = Args(), QByteArray *stdoutData = NULL, QByteArray *stderrData = NULL,
const QByteArray &in = QByteArray())
{
QProcess p;
initTestProcess(&p);
p.start( QApplication::applicationFilePath(), arguments );

p.write(in);
Expand Down Expand Up @@ -447,9 +455,7 @@ bool Tests::startServer()
m_server->deleteLater();
m_server = new QProcess(this);

QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("COPYQ_TESTING", "1");
m_server->setProcessEnvironment(env);
initTestProcess(m_server);

m_server->start( QApplication::applicationFilePath(), QIODevice::ReadOnly );
m_server->waitForStarted();
Expand Down

0 comments on commit 060b602

Please sign in to comment.