mirror of
https://github.com/hanzoai/yoga.git
synced 2026-10-30 19:34:29 +00:00
Summary: Add HTML fixture files for CSS Grid tests and generated test output for C++, Java, and JavaScript. Includes: - HTML fixture files defining grid layout test cases - Generated C++ tests (YGGridTest.cpp, YGGridTestFlows.cpp, ~150 individual test files) - Generated Java tests (YGGridTest.java, YGGridTestFlows.java, ~150 individual test files) - Generated JavaScript tests (YGGridTest.test.ts, YGGridTestFlows.test.ts, ~150 individual test files) Differential Revision: D93946254
91 lines
3.5 KiB
C++
91 lines
3.5 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<<3e73b9f0599ada1744b51fc6bd798eee>>
|
|
* generated by gentest/src/GentestDriver.ts from gentest/fixtures/grid_align_items_baseline_child.html
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <yoga/Yoga.h>
|
|
#include "../util/TestUtil.h"
|
|
|
|
TEST(YogaTest, grid_align_items_baseline_child) {
|
|
YGConfigRef config = YGConfigNew();
|
|
|
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
|
YGNodeStyleSetDisplay(root, YGDisplayGrid);
|
|
YGNodeStyleSetWidth(root, 100);
|
|
YGNodeStyleSetHeight(root, 100);
|
|
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
|
|
|
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetDisplay(root_child0, YGDisplayGrid);
|
|
YGNodeStyleSetWidth(root_child0, 50);
|
|
YGNodeStyleSetHeight(root_child0, 50);
|
|
YGNodeInsertChild(root, root_child0, 0);
|
|
|
|
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetDisplay(root_child1, YGDisplayGrid);
|
|
YGNodeStyleSetWidth(root_child1, 50);
|
|
YGNodeStyleSetHeight(root_child1, 20);
|
|
YGNodeInsertChild(root, root_child1, 1);
|
|
|
|
YGNodeRef root_child1_child0 = YGNodeNewWithConfig(config);
|
|
YGNodeStyleSetDisplay(root_child1_child0, YGDisplayGrid);
|
|
YGNodeStyleSetWidth(root_child1_child0, 50);
|
|
YGNodeStyleSetHeight(root_child1_child0, 10);
|
|
YGNodeInsertChild(root_child1, root_child1_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(50, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_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(50, YGNodeLayoutGetLeft(root_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
|
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
|
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
|
|
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1_child0));
|
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child0));
|
|
|
|
YGNodeFreeRecursive(root);
|
|
|
|
YGConfigFree(config);
|
|
}
|