Automatic lint fixes

Summary:
@public
A round of automatic lint fixes.

Reviewed By: SidharthGuglani

Differential Revision: D14590396

fbshipit-source-id: f0b4a0ce503a1d9d46ea7ae788f9f2eac09c2ac7
This commit is contained in:
David Aurelio
2019-03-25 05:37:36 -07:00
committed by Facebook Github Bot
parent 7d7b7b9e18
commit 85352c4e45
66 changed files with 833 additions and 917 deletions

View File

@@ -325,10 +325,10 @@ TEST(YogaTest, can_be_assigned_from_YGValue) {
YGValue v{2.0f, YGUnitPercent};
c = v;
ASSERT_EQ((YGValue)c, v);
ASSERT_EQ((YGValue) c, v);
c = YGValue{123, YGUnitPoint};
ASSERT_EQ((YGValue)c, (YGValue{123, YGUnitPoint}));
ASSERT_EQ((YGValue) c, (YGValue{123, YGUnitPoint}));
}
TEST(YogaTest, compact_value_bound_representations) {

View File

@@ -4,7 +4,8 @@
* 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/YGAbsolutePositionTest.html
// @Generated by gentest/gentest.rb from
// gentest/fixtures/YGAbsolutePositionTest.html
#include <gtest/gtest.h>
#include <yoga/Yoga.h>
@@ -183,7 +184,9 @@ TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
YGConfigFree(config);
}
TEST(YogaTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
TEST(
YogaTest,
do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -575,7 +578,9 @@ TEST(YogaTest, absolute_layout_align_items_center_on_child_only) {
YGConfigFree(config);
}
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_position) {
TEST(
YogaTest,
absolute_layout_align_items_and_justify_content_center_and_top_position) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -620,7 +625,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_po
YGConfigFree(config);
}
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
TEST(
YogaTest,
absolute_layout_align_items_and_justify_content_center_and_bottom_position) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -665,7 +672,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom
YGConfigFree(config);
}
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_position) {
TEST(
YogaTest,
absolute_layout_align_items_and_justify_content_center_and_left_position) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -710,7 +719,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_p
YGConfigFree(config);
}
TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_right_position) {
TEST(
YogaTest,
absolute_layout_align_items_and_justify_content_center_and_right_position) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);

View File

@@ -8,8 +8,10 @@
#include <yoga/YGNode.h>
#include <yoga/Yoga.h>
static float
_baselineFunc(YGNodeRef node, const float width, const float height) {
static float _baselineFunc(
YGNodeRef node,
const float width,
const float height) {
return height / 2;
}

View File

@@ -4,7 +4,8 @@
* 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/YGAlignContentTest.html
// @Generated by gentest/gentest.rb from
// gentest/fixtures/YGAlignContentTest.html
#include <gtest/gtest.h>
#include <yoga/Yoga.h>

View File

@@ -8,11 +8,12 @@
#include <yoga/YGNode.h>
#include <yoga/Yoga.h>
static YGSize _measure(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measure(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
return YGSize{
.width = widthMode == YGMeasureModeExactly ? width : 50,
.height = heightMode == YGMeasureModeExactly ? height : 50,

View File

@@ -9,7 +9,7 @@
#include <yoga/Yoga.h>
static float _baseline(YGNodeRef node, const float width, const float height) {
float* baseline = (float*)node->getContext();
float* baseline = (float*) node->getContext();
return *baseline;
}

View File

@@ -89,7 +89,7 @@ TEST(YogaTest, assert_default_values) {
}
TEST(YogaTest, assert_webdefault_values) {
YGConfig *config = YGConfigNew();
YGConfig* config = YGConfigNew();
YGConfigSetUseWebDefaults(config, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
@@ -102,7 +102,7 @@ TEST(YogaTest, assert_webdefault_values) {
}
TEST(YogaTest, assert_webdefault_values_reset) {
YGConfig *config = YGConfigNew();
YGConfig* config = YGConfigNew();
YGConfigSetUseWebDefaults(config, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeReset(root);
@@ -116,7 +116,7 @@ TEST(YogaTest, assert_webdefault_values_reset) {
}
TEST(YogaTest, assert_legacy_stretch_behaviour) {
YGConfig *config = YGConfigNew();
YGConfig* config = YGConfigNew();
YGConfigSetUseLegacyStretchBehaviour(config, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root, 500);

View File

@@ -8,7 +8,7 @@
#include <yoga/YGNode.h>
static void _dirtied(YGNodeRef node) {
int* dirtiedCount = (int*)node->getContext();
int* dirtiedCount = (int*) node->getContext();
(*dirtiedCount)++;
}

View File

@@ -4,7 +4,8 @@
* 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/YGFlexDirectionTest.html
// @Generated by gentest/gentest.rb from
// gentest/fixtures/YGFlexDirectionTest.html
#include <gtest/gtest.h>
#include <yoga/Yoga.h>

View File

@@ -29,7 +29,9 @@ protected:
YGConfigRef config;
};
TEST_F(YogaTest_HadOverflowTests, children_overflow_no_wrap_and_no_flex_children) {
TEST_F(
YogaTest_HadOverflowTests,
children_overflow_no_wrap_and_no_flex_children) {
const YGNodeRef child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(child0, 80);
YGNodeStyleSetHeight(child0, 40);
@@ -47,7 +49,9 @@ TEST_F(YogaTest_HadOverflowTests, children_overflow_no_wrap_and_no_flex_children
ASSERT_TRUE(YGNodeLayoutGetHadOverflow(root));
}
TEST_F(YogaTest_HadOverflowTests, spacing_overflow_no_wrap_and_no_flex_children) {
TEST_F(
YogaTest_HadOverflowTests,
spacing_overflow_no_wrap_and_no_flex_children) {
const YGNodeRef child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(child0, 80);
YGNodeStyleSetHeight(child0, 40);

View File

@@ -9,7 +9,8 @@
// This test isn't correct from the Flexbox standard standpoint,
// because percentages are calculated with parent constraints.
// However, we need to make sure we fail gracefully in this case, not returning NaN
// However, we need to make sure we fail gracefully in this case, not returning
// NaN
TEST(YogaTest, percent_absolute_position_infinite_height) {
const YGConfigRef config = YGConfigNew();

View File

@@ -10,17 +10,19 @@
namespace {
char writeBuffer[4096];
int _unmanagedLogger(const YGConfigRef config,
const YGNodeRef node,
YGLogLevel level,
const char *format,
va_list args) {
return vsnprintf(writeBuffer + strlen(writeBuffer),
sizeof(writeBuffer) - strlen(writeBuffer),
format,
args);
}
int _unmanagedLogger(
const YGConfigRef config,
const YGNodeRef node,
YGLogLevel level,
const char* format,
va_list args) {
return vsnprintf(
writeBuffer + strlen(writeBuffer),
sizeof(writeBuffer) - strlen(writeBuffer),
format,
args);
}
} // namespace
TEST(YogaTest, config_print_tree_enabled) {
writeBuffer[0] = '\0';
@@ -68,13 +70,16 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
YGConfigSetLogger(config, _unmanagedLogger);
const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
YGNodePrint(root,
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
YGPrintOptionsStyle));
YGNodePrint(
root,
(YGPrintOptions)(
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
YGConfigSetLogger(config, NULL);
YGNodeFree(root);
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" ></div>";
const char* expected =
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
"></div>";
ASSERT_STREQ(expected, writeBuffer);
}
@@ -90,15 +95,17 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
YGNodeStyleSetMargin(root, YGEdgeRight, 10);
YGNodeStyleSetMarginAuto(root, YGEdgeLeft);
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
YGNodePrint(root,
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
YGPrintOptionsStyle));
YGNodePrint(
root,
(YGPrintOptions)(
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
YGConfigSetLogger(config, NULL);
YGNodeFree(root);
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
"position: absolute; \" ></div>";
const char* expected =
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
"position: absolute; \" ></div>";
ASSERT_STREQ(expected, writeBuffer);
}
@@ -112,15 +119,17 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
YGNodeInsertChild(root, child0, 0);
YGNodeInsertChild(root, child1, 1);
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
YGNodePrint(root,
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
YGPrintOptionsStyle));
YGNodePrint(
root,
(YGPrintOptions)(
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
YGConfigSetLogger(config, NULL);
YGNodeFreeRecursive(root);
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
"style=\"\" ></div>\n</div>";
const char* expected =
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
"style=\"\" ></div>\n</div>";
ASSERT_STREQ(expected, writeBuffer);
}

View File

@@ -8,12 +8,13 @@
#include <yoga/YGNode.h>
#include <yoga/Yoga.h>
static YGSize _measureMax(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*)node->getContext();
static YGSize _measureMax(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*) node->getContext();
(*measureCount)++;
return YGSize{
@@ -22,37 +23,40 @@ static YGSize _measureMax(YGNodeRef node,
};
}
static YGSize _measureMin(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*)node->getContext();
static YGSize _measureMin(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*) node->getContext();
*measureCount = *measureCount + 1;
return YGSize{
.width =
widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10)
? 10
: width,
.height =
heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10)
? 10
: height,
.width = widthMode == YGMeasureModeUndefined ||
(widthMode == YGMeasureModeAtMost && width > 10)
? 10
: width,
.height = heightMode == YGMeasureModeUndefined ||
(heightMode == YGMeasureModeAtMost && height > 10)
? 10
: height,
};
}
static YGSize _measure_84_49(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*)node->getContext();
static YGSize _measure_84_49(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
int* measureCount = (int*) node->getContext();
if (measureCount) {
(*measureCount)++;
}
return YGSize{
.width = 84.f, .height = 49.f,
.width = 84.f,
.height = 49.f,
};
}
@@ -149,7 +153,9 @@ TEST(YogaTest, remeasure_with_atmost_computed_width_undefined_height) {
YGNodeFreeRecursive(root);
}
TEST(YogaTest, remeasure_with_already_measured_value_smaller_but_still_float_equal) {
TEST(
YogaTest,
remeasure_with_already_measured_value_smaller_but_still_float_equal) {
int measureCount = 0;
const YGNodeRef root = YGNodeNew();

View File

@@ -17,17 +17,18 @@ struct _MeasureConstraint {
struct _MeasureConstraintList {
uint32_t length;
struct _MeasureConstraint *constraints;
struct _MeasureConstraint* constraints;
};
static YGSize _measure(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measure(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
struct _MeasureConstraintList* constraintList =
(struct _MeasureConstraintList*)node->getContext();
struct _MeasureConstraint *constraints = constraintList->constraints;
(struct _MeasureConstraintList*) node->getContext();
struct _MeasureConstraint* constraints = constraintList->constraints;
uint32_t currentIndex = constraintList->length;
(&constraints[currentIndex])->width = width;
(&constraints[currentIndex])->widthMode = widthMode;
@@ -44,7 +45,8 @@ static YGSize _measure(YGNodeRef node,
TEST(YogaTest, exactly_measure_stretched_child_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -72,7 +74,8 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
TEST(YogaTest, exactly_measure_stretched_child_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -100,7 +103,8 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
TEST(YogaTest, at_most_main_axis_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -126,7 +130,8 @@ TEST(YogaTest, at_most_main_axis_column) {
TEST(YogaTest, at_most_cross_axis_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -153,7 +158,8 @@ TEST(YogaTest, at_most_cross_axis_column) {
TEST(YogaTest, at_most_main_axis_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -180,7 +186,8 @@ TEST(YogaTest, at_most_main_axis_row) {
TEST(YogaTest, at_most_cross_axis_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -208,7 +215,8 @@ TEST(YogaTest, at_most_cross_axis_row) {
TEST(YogaTest, flex_child) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -237,7 +245,8 @@ TEST(YogaTest, flex_child) {
TEST(YogaTest, flex_child_with_flex_basis) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -264,7 +273,8 @@ TEST(YogaTest, flex_child_with_flex_basis) {
TEST(YogaTest, overflow_scroll_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();
@@ -295,7 +305,8 @@ TEST(YogaTest, overflow_scroll_column) {
TEST(YogaTest, overflow_scroll_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
.constraints = (struct _MeasureConstraint*) malloc(
10 * sizeof(struct _MeasureConstraint)),
};
const YGNodeRef root = YGNodeNew();

View File

@@ -4,7 +4,8 @@
* 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/YGMinMaxDimensionTest.html
// @Generated by gentest/gentest.rb from
// gentest/fixtures/YGMinMaxDimensionTest.html
#include <gtest/gtest.h>
#include <yoga/Yoga.h>

View File

@@ -647,7 +647,9 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
YGConfigFree(config);
}
TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_values) {
TEST(
YogaTest,
percentage_multiple_nested_with_padding_margin_and_percentage_values) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);

View File

@@ -9,7 +9,8 @@
TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
const YGConfigRef config = YGConfigNew();
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureWebFlexBasis, true);
YGConfigSetExperimentalFeatureEnabled(
config, YGExperimentalFeatureWebFlexBasis, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetHeightPercent(root, 100);

View File

@@ -24,7 +24,8 @@ TEST(YogaTest, rounding_value) {
ASSERT_FLOAT_EQ(-6.0, YGRoundValueToPixelGrid(-5.999999, 2.0, true, false));
ASSERT_FLOAT_EQ(-6.0, YGRoundValueToPixelGrid(-5.999999, 2.0, false, true));
// Test that numbers with fraction are rounded correctly accounting for ceil/floor flags
// Test that numbers with fraction are rounded correctly accounting for
// ceil/floor flags
ASSERT_FLOAT_EQ(6.0, YGRoundValueToPixelGrid(6.01, 2.0, false, false));
ASSERT_FLOAT_EQ(6.5, YGRoundValueToPixelGrid(6.01, 2.0, true, false));
ASSERT_FLOAT_EQ(6.0, YGRoundValueToPixelGrid(6.01, 2.0, false, true));

View File

@@ -8,33 +8,39 @@
#include <yoga/YGNode.h>
#include <yoga/Yoga.h>
static YGSize _measureFloor(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measureFloor(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
return YGSize{
width = 10.2f, height = 10.2f,
width = 10.2f,
height = 10.2f,
};
}
static YGSize _measureCeil(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measureCeil(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
return YGSize{
width = 10.5f, height = 10.5f,
width = 10.5f,
height = 10.5f,
};
}
static YGSize _measureFractial(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measureFractial(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
return YGSize{
width = 0.5f, height = 0.5f,
width = 0.5f,
height = 0.5f,
};
}
@@ -106,7 +112,9 @@ TEST(YogaTest, rounding_feature_with_custom_measure_func_ceil) {
YGConfigFree(config);
}
TEST(YogaTest, rounding_feature_with_custom_measure_and_fractial_matching_scale) {
TEST(
YogaTest,
rounding_feature_with_custom_measure_and_fractial_matching_scale) {
const YGConfigRef config = YGConfigNew();
const YGNodeRef root = YGNodeNewWithConfig(config);

View File

@@ -4,7 +4,8 @@
* 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/YGSizeOverflowTest.html
// @Generated by gentest/gentest.rb from
// gentest/fixtures/YGSizeOverflowTest.html
#include <gtest/gtest.h>
#include <yoga/Yoga.h>

View File

@@ -12,21 +12,16 @@ TEST(YogaTest, pre_order_traversal) {
YGNodeRef const root_child0 = YGNodeNew();
YGNodeRef const root_child1 = YGNodeNew();
YGNodeRef const root_child0_child0 = YGNodeNew();
YGNodeSetChildren(root, {root_child0, root_child1});
YGNodeInsertChild(root_child0, root_child0_child0, 0);
std::vector<YGNodeRef> visited;
YGTraversePreOrder(root, [&visited](YGNodeRef node) {
visited.push_back(node);
});
YGTraversePreOrder(
root, [&visited](YGNodeRef node) { visited.push_back(node); });
const std::vector<YGNodeRef> expected = {
root,
root_child0,
root_child0_child0,
root_child1
};
root, root_child0, root_child0_child0, root_child1};
ASSERT_EQ(visited, expected);
YGNodeFreeRecursive(root);

View File

@@ -7,12 +7,11 @@
#include <gtest/gtest.h>
#include <yoga/Yoga.h>
static std::vector<YGNodeRef> getChildren(YGNodeRef const node)
{
static std::vector<YGNodeRef> getChildren(YGNodeRef const node) {
const uint32_t count = YGNodeGetChildCount(node);
std::vector<YGNodeRef> children;
children.reserve(count);
for (uint32_t i = 0 ; i < count ; i++) {
for (uint32_t i = 0; i < count; i++) {
children.push_back(YGNodeGetChild(node, i));
}
return children;
@@ -29,7 +28,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);
@@ -48,7 +48,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);
@@ -71,7 +72,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);
@@ -93,15 +95,14 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) {
YGNodeSetChildren(root, {root_child2, root_child1, root_child3});
const std::vector<YGNodeRef> children = getChildren(root);
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child1, root_child3};
const std::vector<YGNodeRef> expectedChildren = {
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);