diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-01-23 16:59:59 -0800 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-02-06 18:49:06 +0100 |
commit | 26a00f6a3139a95ec098269a219d0765447b5853 (patch) | |
tree | a9350f0e9f7e4a543479c854f743faf9313bdfbc /test | |
parent | 93c4a23636841ad81eaf49fcfab28f25d0ec868b (diff) | |
download | qtlocation-mapboxgl-26a00f6a3139a95ec098269a219d0765447b5853.tar.gz |
[core] prioritize Thread::pause() calls
Diffstat (limited to 'test')
-rw-r--r-- | test/util/run_loop.test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/util/run_loop.test.cpp b/test/util/run_loop.test.cpp index 57bc613f9e..4d2c704421 100644 --- a/test/util/run_loop.test.cpp +++ b/test/util/run_loop.test.cpp @@ -50,3 +50,17 @@ TEST(RunLoop, MultipleRun) { EXPECT_TRUE(secondTimeout); } + +TEST(RunLoop, Priorities) { + std::vector<int> order; + + RunLoop loop(RunLoop::Type::New); + loop.invoke([&] { order.push_back(1); }); + loop.invoke(RunLoop::Priority::High, [&] { order.push_back(2); }); + loop.invoke([&] { order.push_back(3); }); + loop.invoke(RunLoop::Priority::High, [&] { order.push_back(4); }); + loop.invoke(RunLoop::Priority::Default, [&] { loop.stop(); }); + loop.run(); + + EXPECT_EQ((std::vector<int>{ 2, 4, 1, 3 }), order); +} |