MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / TEST_F

Function TEST_F

tests/src/App/AsyncRecompute.cpp:61–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59};
60
61TEST_F(AsyncRecomputeTest, CloseDocumentWaitsForInFlightAsyncRecompute)
62{
63 auto* object = dynamic_cast<App::FeatureTestAsyncBlocker*>(
64 _doc->addObject("App::FeatureTestAsyncBlocker", "BlockingFeature")
65 );
66 ASSERT_NE(object, nullptr);
67
68 App::FeatureTestAsyncBlocker::resetBlocker();
69 BOOST_SCOPE_EXIT_ALL(&)
70 {
71 App::FeatureTestAsyncBlocker::releaseBlocker();
72 };
73
74 object->touch();
75
76 App::GetApplication().queueRecomputeRequest(App::RecomputeRequest::fromDocumentObject(*object));
77
78 ASSERT_TRUE(App::FeatureTestAsyncBlocker::waitUntilStarted(2s));
79
80 auto closeFuture = std::async(std::launch::async, [this] {
81 return App::GetApplication().closeDocument(_docName.c_str());
82 });
83
84 EXPECT_EQ(closeFuture.wait_for(50ms), std::future_status::timeout);
85
86 App::FeatureTestAsyncBlocker::releaseBlocker();
87
88 ASSERT_EQ(closeFuture.wait_for(2s), std::future_status::ready);
89 EXPECT_TRUE(closeFuture.get());
90
91 _doc = nullptr;
92}
93
94TEST_F(AsyncRecomputeTest, WorkerSafetyIsCheckedFromRequest)
95{

Callers

nothing calls this directly

Calls 7

queueRecomputeRequestMethod · 0.80
closeDocumentMethod · 0.80
addObjectMethod · 0.45
touchMethod · 0.45
c_strMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected