[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] tier1/threadweaver/autotests: Refactor CollectionQueueingTest.
From: Mirko Boehm (Endocode) <mirko () endocode ! com>
Date: 2013-12-07 15:10:31
Message-ID: E1VpJWZ-0006IK-6W () scm ! kde ! org
[Download RAW message or body]
Git commit bcdeaabeb56550278ef7ff056afd2796065bb0c3 by Mirko Boehm (Endocod=
e).
Committed on 07/12/2013 at 13:15.
Pushed by mirko into branch 'frameworks'.
Refactor CollectionQueueingTest.
M +8 -11 tier1/threadweaver/autotests/JobTests.cpp
http://commits.kde.org/kdelibs/bcdeaabeb56550278ef7ff056afd2796065bb0c3
diff --git a/tier1/threadweaver/autotests/JobTests.cpp b/tier1/threadweaver=
/autotests/JobTests.cpp
index 0e734ff..00c626d 100644
--- a/tier1/threadweaver/autotests/JobTests.cpp
+++ b/tier1/threadweaver/autotests/JobTests.cpp
@@ -79,7 +79,7 @@ void JobTests::SimpleJobTest() {
WaitForIdleAndFinished w(Weaver::instance());
stream() << new AppendCharacterJob( QChar('1'), &sequence);
Weaver::instance()->finish();
- QCOMPARE ( sequence, QString( "1" ) );
+ QCOMPARE(sequence, QString("1"));
}
=
void JobTests::SimpleJobCollectionTest() {
@@ -113,23 +113,20 @@ void JobTests::EmptyJobCollectionTest() {
=
void JobTests::CollectionQueueingTest()
{
- QString sequence;
- JobPointer jobA(new AppendCharacterJob(QChar('a'), &sequence));
- JobPointer jobB(new AppendCharacterJob(QChar('b'), &sequence));
- JobPointer jobC(new AppendCharacterJob(QChar('c'), &sequence));
- QSharedPointer<JobCollection> jobCollection(new JobCollection());
- jobCollection->addJob(jobA);
- jobCollection->addJob(jobB);
- jobCollection->addJob(jobC);
+ QString output;
+ JobCollection jobCollection;
+ jobCollection << new AppendCharacterJob(QChar('a'), &output)
+ << new AppendCharacterJob(QChar('b'), &output)
+ << new AppendCharacterJob(QChar('c'), &output);
=
Weaver weaver;
WaitForIdleAndFinished w(&weaver);
weaver.suspend();
- weaver.enqueue(jobCollection);
+ weaver.stream() << jobCollection;
QCOMPARE(weaver.queueLength(), 1); //collection queues itself, and it'=
s elements upon execution of self
weaver.resume();
weaver.finish();
- QCOMPARE(sequence.length(), 3);
+ QCOMPARE(output.length(), 3);
QVERIFY(Weaver::instance()->isIdle());
}
=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic