mirror of
https://github.com/hanzoai/yoga.git
synced 2026-10-30 19:34:29 +00:00
Summary: Pull Request resolved: https://github.com/react/yoga/pull/2001 Removes the disabled (`data-disabled`) intrinsic-sizing test cases from the gentest fixtures and their generated Java/C++/JS tests. These cases (fit-content / max-content / stretch, several gated behind the `FixFlexBasisFitContent` experiment) were checked in disabled because Yoga's layout does not yet match the browser reference for them, so they only ever produce skipped tests. Remove them for now; re-add and enable once the behavior is implemented. Also removes the now-orphaned TODO comments that annotated those cases. Reviewed By: GijsWeterings, cortinico Differential Revision: D113528568 fbshipit-source-id: d3ce19f2cd5eb994170cf7d3995d9748212b55c9
56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* clang-format off
|
|
* @generated SignedSource<<afc7c6b3018d72cb2365b372df4f0b66>>
|
|
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/YGAspectRatioTest.html
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <yoga/Yoga.h>
|
|
#include "../util/TestUtil.h"
|
|
|
|
TEST(YogaTest, zero_aspect_ratio_behaves_like_auto) {
|
|
YGConfigRef config = YGConfigNew();
|
|
|
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetWidth(root, 300);
|
|
YGNodeStyleSetHeight(root, 300);
|
|
|
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetAspectRatio(root_child0, 0);
|
|
YGNodeStyleSetWidth(root_child0, 50);
|
|
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(300, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(50, 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(300, YGNodeLayoutGetWidth(root));
|
|
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
|
|
|
ASSERT_FLOAT_EQ(250, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|