diff options
| author | Liang Qi <liang.qi@qt.io> | 2017-03-02 09:04:38 +0100 |
|---|---|---|
| committer | Liang Qi <liang.qi@qt.io> | 2017-03-02 09:04:38 +0100 |
| commit | 71264bae08d81bdeceb96133fdb01c370504dfcc (patch) | |
| tree | d5dadaac8209d5ef1857a4d65197b9ee12b39848 /tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp | |
| parent | 5e785c0b83c9908c665f253c131629ac325a21f5 (diff) | |
| parent | 6d10f739cd750968d0dd0e9d8fa4b64353a86c6c (diff) | |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I84097f8e7b3b2128028bd7693c913d6968b82bfe
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp')
| -rw-r--r-- | tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp index bd53aa69fe0..4e3668d72e0 100644 --- a/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -123,6 +123,28 @@ public: int operator()(int in) const { return in; } }; +class ANoExcept +{ +public: + int member0() Q_DECL_NOTHROW { return 10; } + int member1(int in) Q_DECL_NOTHROW { return in; } + + typedef int result_type; + int operator()() Q_DECL_NOTHROW { return 10; } + int operator()(int in) Q_DECL_NOTHROW { return in; } +}; + +class AConstNoExcept +{ +public: + int member0() const Q_DECL_NOTHROW { return 10; } + int member1(int in) const Q_DECL_NOTHROW { return in; } + + typedef int result_type; + int operator()() const Q_DECL_NOTHROW { return 10; } + int operator()(int in) const Q_DECL_NOTHROW { return in; } +}; + void tst_QtConcurrentRun::returnValue() { QThreadPool pool; @@ -214,6 +236,88 @@ void tst_QtConcurrentRun::returnValue() QCOMPARE(f.result(), 20); f = run(&pool, &aConst, 20); QCOMPARE(f.result(), 20); + + ANoExcept aNoExcept; + f = run(&aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, &aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(&aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, aNoExcept, &ANoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aNoExcept, &ANoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, aNoExcept); + QCOMPARE(f.result(), 10); + + f = run(&aNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, &aNoExcept); + QCOMPARE(f.result(), 10); + + f = run(aNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aNoExcept, 20); + QCOMPARE(f.result(), 20); + + f = run(&aNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aNoExcept, 20); + QCOMPARE(f.result(), 20); + + const AConstNoExcept aConstNoExcept = AConstNoExcept(); + f = run(&aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, &aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(&aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + f = run(&pool, aConstNoExcept, &AConstNoExcept::member0); + QCOMPARE(f.result(), 10); + + f = run(aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aConstNoExcept, &AConstNoExcept::member1, 20); + QCOMPARE(f.result(), 20); + + f = run(aConstNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, aConstNoExcept); + QCOMPARE(f.result(), 10); + + f = run(&aConstNoExcept); + QCOMPARE(f.result(), 10); + f = run(&pool, &aConstNoExcept); + QCOMPARE(f.result(), 10); + + f = run(aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + + f = run(&aConstNoExcept, 20); + QCOMPARE(f.result(), 20); + f = run(&pool, &aConstNoExcept, 20); + QCOMPARE(f.result(), 20); } struct TestClass |
