Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASDisplayNode] Add unit tests for layout z-order changes (with an open issue to fix). #816

Merged
merged 1 commit into from
Mar 2, 2018

Conversation

appleguy
Copy link
Member

@appleguy appleguy commented Mar 2, 2018

Right now, automatic subnode management is not fixing up the z-order for nodes and their views, whenever existing subnodes are moved to a different place in the layout.

This can result in particularly weird issues when an existing layout changes with some additional nodes and some removed nodes that may displace or separate some existing nodes that also need to change order.

Once we fix, it will be easy to improve the Overlay and Background tests that are below this to also check the reversal / relayout case (I don't think they would pass currently). cc @maicki @nguyenhuy @Adlai-Holler

ASDisplayNodeTests.mm:2410: error: -[ASDisplayNodeTests testThatStackSpecOrdersSubnodesCorrectly] : (([node.subnodes isEqualToArray:nodesReverseOrder]) is true) failed - subnodes: (
    "<ASDisplayNode: 0x7f8281101f90; a>",
    "<ASDisplayNode: 0x7f8281105b40; b>",
    "<ASDisplayNode: 0x7f8281105e80; c>",
    "<ASDisplayNode: 0x7f82811061c0; d>"
), reference array: (
    "<ASDisplayNode: 0x7f82811061c0; d>",
    "<ASDisplayNode: 0x7f8281105e80; c>",
    "<ASDisplayNode: 0x7f8281105b40; b>",
    "<ASDisplayNode: 0x7f8281101f90; a>"
)
Test Case '-[ASDisplayNodeTests testThatStackSpecOrdersSubnodesCorrectly]' failed (0.006 seconds).

@appleguy appleguy self-assigned this Mar 2, 2018
}

XCTAssert([mutableInsertions count] == 0, @"Unaccounted insertions: %@", mutableInsertions);
Copy link
Member Author

@appleguy appleguy Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these mutable index sets and checking that all values were consumed, the test actually didn't fail when I tried deleting one of the supposed-to-be-present index values from the test set.

So although everything seems to behave correctly, this was important to ensure the validation checks both necessity and sufficiency of the test set.

Copy link
Member

@nguyenhuy nguyenhuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too.

I remember we had plans on implementing it soon, but unfortunately time and other stuff came in between ...

@maicki maicki merged commit 8b4a7cd into master Mar 2, 2018
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants