Added the stop() slot to QIODeviceCopier.

This commit is contained in:
Nathan Osman
2015-07-09 14:58:24 -07:00
parent ddfb889c10
commit 1eefc63ca4
3 changed files with 40 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ private Q_SLOTS:
void testQBuffer();
void testQTcpSocket();
void testStop();
};
void TestQIODeviceCopier::testQBuffer()
@@ -88,5 +89,26 @@ void TestQIODeviceCopier::testQTcpSocket()
QCOMPARE(destData, SampleData);
}
void TestQIODeviceCopier::testStop()
{
QSocketPair pair;
QTRY_VERIFY(pair.isConnected());
QByteArray destData;
QBuffer dest(&destData);
QIODeviceCopier copier(pair.server(), &dest);
copier.start();
pair.client()->write(SampleData);
QTRY_COMPARE(destData, SampleData);
copier.stop();
pair.client()->write(SampleData);
QTRY_COMPARE(destData, SampleData);
}
QTEST_MAIN(TestQIODeviceCopier)
#include "TestQIODeviceCopier.moc"