Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonzalez committed Nov 22, 2017
1 parent de1d0f9 commit 80dea21
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 7 deletions.
11 changes: 6 additions & 5 deletions tests/test01/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,10 @@ TEST_CASE("Should call second chained then rejected callback after second reject
TEST_CASE("Should call last chained then rejected callback after first rejected called", "[then][reject][chain]")
{
// init
QDefer defer1;
QDeferred<bool> defer1;
// subscribe then callback
defer1.then<int>([]() {
defer1.then<int>([](bool val) {
Q_UNUSED(val);
QDeferred<int> defer2;
REQUIRE(false);
return defer2;
Expand All @@ -524,12 +525,12 @@ TEST_CASE("Should call last chained then rejected callback after first rejected
Q_UNUSED(val);
REQUIRE(false);
return defer5;
}, []() { // fail over 'defer2' with zero args
}, []() { // fail over 'defer1' with zero args
// test that gets called
REQUIRE(true);
});
// reject
defer1.reject();
defer1.reject(false);

QT_PROCESS_ALL_EVENTS
}
Expand Down Expand Up @@ -588,7 +589,7 @@ TEST_CASE("Should call last chained then rejected callback after third rejected
// test that gets called
REQUIRE(val == 123);
// reject third and return
defer3.reject(456);
defer3.reject(456); // reject here
return defer3;
}).then<int>([](int val) {
QDeferred<int> defer4;
Expand Down
2 changes: 2 additions & 0 deletions tests/test02/test02.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ HEADERS += threadworker.h

SOURCES += main.cpp \
threadworker.cpp

include(./../add_qt_path.pri)
5 changes: 4 additions & 1 deletion tests/test03/threadworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ QDeferred<int> ThreadController::doProgressWork(int delay, int max)
if (counter < max || (counter > max && counter <= 1.1*max))
{
qDebug() << "[INFO] Deferred notify with " << counter << " in thread = " << QThread::currentThread();
retDeferred.notify(counter);
if (retDeferred.state() == PENDING)
{
retDeferred.notify(counter);
}
}
else if (counter == max)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/test04/test04.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ include(./../../src/qlambdathreadworker.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test05/test05.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ include(./../../src/qlambdathreadworker.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test06/test06.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ include(./../../src/qlambdathreadworker.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test07/test07.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ include(./../../src/qlambdathreadworker.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test08/test08.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ HEADERS += derived.h \

SOURCES += main.cpp \
derived.cpp

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test09/test09.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ include(./../../src/qlambdathreadworker.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
2 changes: 2 additions & 0 deletions tests/test10/test10.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ include(./../../src/qeventer.pri)
TEMPLATE = app

SOURCES += main.cpp \

include(./../add_qt_path.pri)
3 changes: 2 additions & 1 deletion tests/test11/test11.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ TEMPLATE = app

include(./../../src/qlambdathreadworker.pri)
include(./../../src/qdeferred.pri)
include(./../../src/add_qt_path.pri)

SOURCES += main.cpp \

include(./../add_qt_path.pri)

0 comments on commit 80dea21

Please sign in to comment.