Simplify timer use.

This commit is contained in:
Howard Stearns 2015-09-09 15:19:01 -07:00
parent 5e8fe29674
commit 738da0116a

View file

@ -131,17 +131,13 @@ void AnimTests::testLoader() {
const int timeout = 1000;
QEventLoop loop;
QTimer timer;
timer.setInterval(timeout);
timer.setSingleShot(true);
AnimNode::Pointer node = nullptr;
connect(&loader, &AnimNodeLoader::success, [&](AnimNode::Pointer nodeIn) { node = nodeIn; });
loop.connect(&loader, SIGNAL(success(AnimNode::Pointer)), SLOT(quit()));
loop.connect(&loader, SIGNAL(error(int, QString)), SLOT(quit()));
loop.connect(&timer, SIGNAL(timeout()), SLOT(quit()));
timer.start();
QTimer::singleShot(timeout, &loader, SLOT(quit()));
loop.exec();
QVERIFY((bool)node);