Rename tests
Summary: Rename test files to use new name Reviewed By: gkassabli Differential Revision: D4265235 fbshipit-source-id: 0090d3949828058baf7435f33d4068de92756bad
This commit is contained in:
committed by
Facebook Github Bot
parent
dda24b1e23
commit
6339467b6d
73
tests/YGRoundingMeasureFuncTest.cpp
Normal file
73
tests/YGRoundingMeasureFuncTest.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
#include <CSSLayout/Yoga.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
static YGSize _measureFloor(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
return YGSize{
|
||||
width = 10.2,
|
||||
height = 10.2,
|
||||
};
|
||||
}
|
||||
|
||||
static YGSize _measureCeil(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
|
||||
return YGSize{
|
||||
width = 10.5,
|
||||
height = 10.5,
|
||||
};
|
||||
}
|
||||
|
||||
TEST(YogaTest, rounding_feature_with_custom_measure_func_floor) {
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetMeasureFunc(root_child0, _measureFloor);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
|
||||
}
|
||||
|
||||
TEST(YogaTest, rounding_feature_with_custom_measure_func_ceil) {
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeSetMeasureFunc(root_child0, _measureCeil);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(11, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(11, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false);
|
||||
}
|
Reference in New Issue
Block a user