Merge branch 'master' into fix-absolute-with-padding
This commit is contained in:
@@ -303,8 +303,8 @@ EventArgs createArgs(
|
||||
};
|
||||
|
||||
EventArgs args = createArgs<E>(node, data);
|
||||
args.eventTestDataPtr = {new EventTestData{eventTestData},
|
||||
deleteEventTestData};
|
||||
args.eventTestDataPtr = {
|
||||
new EventTestData{eventTestData}, deleteEventTestData};
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_margin) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
@@ -58,12 +59,13 @@ TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, margin_side_overrides_all) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
|
@@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_padding) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
@@ -58,12 +59,13 @@ TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) {
|
||||
}
|
||||
|
||||
TEST(YogaTest, padding_side_overrides_all) {
|
||||
const std::array<YGEdge, 6> edges = {{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
const std::array<YGEdge, 6> edges = {
|
||||
{YGEdgeTop,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeLeft,
|
||||
YGEdgeRight}};
|
||||
|
||||
for (float edgeValue = 0; edgeValue < 2; ++edgeValue) {
|
||||
for (const auto& edge : edges) {
|
||||
|
@@ -20,7 +20,7 @@ TEST(YogaTest, assert_default_values) {
|
||||
ASSERT_EQ(YGAlignFlexStart, YGNodeStyleGetAlignContent(root));
|
||||
ASSERT_EQ(YGAlignStretch, YGNodeStyleGetAlignItems(root));
|
||||
ASSERT_EQ(YGAlignAuto, YGNodeStyleGetAlignSelf(root));
|
||||
ASSERT_EQ(YGPositionTypeRelative, YGNodeStyleGetPositionType(root));
|
||||
ASSERT_EQ(YGPositionTypeStatic, YGNodeStyleGetPositionType(root));
|
||||
ASSERT_EQ(YGWrapNoWrap, YGNodeStyleGetFlexWrap(root));
|
||||
ASSERT_EQ(YGOverflowVisible, YGNodeStyleGetOverflow(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeStyleGetFlexGrow(root));
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -327,3 +328,45 @@ TEST(YogaTest, display_none_with_position) {
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, display_none_with_position_absolute) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeStyleSetDisplay(root_child0, YGDisplayNone);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
@@ -132,9 +132,10 @@ ACCESSOR_TEST(
|
||||
|
||||
ACCESSOR_TEST(
|
||||
positionType,
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeStatic,
|
||||
YGPositionTypeAbsolute,
|
||||
YGPositionTypeRelative)
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeStatic)
|
||||
|
||||
ACCESSOR_TEST(
|
||||
flexWrap,
|
||||
|
@@ -29,8 +29,8 @@ TEST(YogaTest, set_children_adds_children_to_parent) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child0, root_child1};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -49,8 +49,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -73,8 +73,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) {
|
||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
@@ -100,10 +100,11 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) {
|
||||
root_child2, root_child1, root_child3};
|
||||
ASSERT_EQ(children, expectedChildren);
|
||||
|
||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)};
|
||||
const std::vector<YGNodeRef> owners = {
|
||||
YGNodeGetOwner(root_child0),
|
||||
YGNodeGetOwner(root_child1),
|
||||
YGNodeGetOwner(root_child2),
|
||||
YGNodeGetOwner(root_child3)};
|
||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, root, root, root};
|
||||
ASSERT_EQ(owners, expectedOwners);
|
||||
|
||||
|
Reference in New Issue
Block a user