Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions editor/tests/TraceLayerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,30 @@ void SetUp() override

void TearDown() override
{
layer.reset();
destroyLayer();
TraceLayer::setOcclusionForTesting(std::nullopt);
[window orderOut:nil];
[window close];
}

// How long a shown layer is left before it is destroyed. The render server tells a shown
Comment thread
zuurbr marked this conversation as resolved.
Resolved
// layer's display link which display it is on, on Core Animation's own queue, some time after
// the layer is shown (and possibly after it changes). Below macOS 27, a message handled while
// the link is being invalidated reads the link's layer after the invalidation cleared it and
// crashes (#445). Nothing signals the message, so the test waits for it.
Comment thread
zuurbr marked this conversation as resolved.
Resolved
static constexpr auto kSettleBeforeDestroying = 250ms;

// Destroys the layer once a display message for it has had time to be handled. The pump also
// commits a layer change the test made outside a transaction.
void destroyLayer()
{
if (layer == nullptr) {
return;
}
pumpUntil([] { return false; }, kSettleBeforeDestroying);
layer.reset();
}

// The layer shown and drawing: the page up and its trace view sent.
void show()
{
Expand Down Expand Up @@ -431,7 +449,7 @@ NSRect expectedFrame() const
ASSERT_DISPLAY_WAIT(presents());
EXPECT_FALSE(layer->statsForTesting().barcode) << "off";

layer.reset();
destroyLayer();
source.frameBarcode = true;
source.limit = 1;
source.takes = 0;
Expand Down Expand Up @@ -619,7 +637,7 @@ NSRect expectedFrame() const
source.always = true;
show();
ASSERT_DISPLAY_WAIT(presents());
layer.reset();
destroyLayer();
const int requests = source.requests.load();
const int takes = source.takes.load();
pumpUntil([] { return false; }, 300ms);
Expand Down
Loading