Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar committed Aug 16, 2024
1 parent 07beedc commit 2739895
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions native/tests/unit-test/src/scheduler_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ using namespace cc;
TEST(schedulerTest, performInCocosThreadOrder) {
auto *scheduler = new Scheduler();

std::vector<int> orderResult;
static std::vector<int> orderResult;

for (int i = 0; i < 10; ++i) {
auto task = [&orderResult, i, scheduler](){
auto task = [i, scheduler](){
orderResult.emplace_back(i);

if (i == 5) {
scheduler->performFunctionInCocosThread([&orderResult](){
scheduler->performFunctionInCocosThread([](){
orderResult.emplace_back(10);
});

scheduler->performFunctionInCocosThread([&orderResult](){
scheduler->performFunctionInCocosThread([](){
orderResult.emplace_back(11);
});

scheduler->performFunctionInCocosThread([&orderResult](){
scheduler->performFunctionInCocosThread([](){
orderResult.emplace_back(12);
});

Expand All @@ -66,4 +66,5 @@ TEST(schedulerTest, performInCocosThreadOrder) {

delete scheduler;
scheduler = nullptr;
orderResult.clear();
}

0 comments on commit 2739895

Please sign in to comment.