Use fbsource clang-format config
Summary: This mirrors the clang-format config used by fbsource to Yoga. They are pretty similar, except for an annoying habit where Yoga's previous forced small functions in headers to be a a single line, so you would get a combination of multiline and single line functions next to each other which are hard to read. That is what motivated this change. It also enforces header ordering (yay). I don't think we have any side-effect causing headers, so this should be safe. Reviewed By: yungsters Differential Revision: D49248994 fbshipit-source-id: 66998395e7c0158ff9d9fb1bee44e8401bdd8f21
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9d21e3e300
commit
f9c2c27d33
@@ -7,8 +7,8 @@
|
||||
|
||||
#define YOGA_COMPACT_VALUE_TEST
|
||||
|
||||
#include <yoga/style/CompactValue.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/style/CompactValue.h>
|
||||
#include <cmath>
|
||||
|
||||
using facebook::yoga::CompactValue;
|
||||
@@ -326,10 +326,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) {
|
||||
|
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/event/event.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/YGEnums.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/event/event.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@@ -48,9 +48,11 @@ class EventTest : public ::testing::Test {
|
||||
ScopedEventSubscription subscription = {&EventTest::listen};
|
||||
static void listen(YGNodeConstRef, Event::Type, Event::Data);
|
||||
|
||||
public:
|
||||
public:
|
||||
static std::vector<EventArgs> events;
|
||||
static EventArgs& lastEvent() { return events.back(); }
|
||||
static EventArgs& lastEvent() {
|
||||
return events.back();
|
||||
}
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
|
@@ -7,9 +7,9 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <yoga/YGValue.h>
|
||||
#include <yoga/numeric/Comparison.h>
|
||||
#include <yoga/numeric/FloatOptional.h>
|
||||
#include <yoga/YGValue.h>
|
||||
|
||||
using namespace facebook;
|
||||
using namespace facebook::yoga;
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <yoga/bits/NumericBitfield.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace facebook::yoga {
|
||||
|
||||
@@ -105,7 +105,7 @@ TEST(NumericBitfield, third_boolean_can_be_set_to_true) {
|
||||
TEST(NumericBitfield, setting_boolean_values_does_not_spill_over) {
|
||||
uint32_t flags = 0;
|
||||
|
||||
setBooleanData(flags, 1, (bool) 7);
|
||||
setBooleanData(flags, 1, (bool)7);
|
||||
|
||||
ASSERT_EQ(getBooleanData(flags, 0), false);
|
||||
ASSERT_EQ(getBooleanData(flags, 1), true);
|
||||
@@ -195,7 +195,7 @@ TEST(NumericBitfield, setting_values_does_not_spill_over) {
|
||||
static constexpr size_t boolOffset = 7;
|
||||
|
||||
uint32_t edge = 0xffffff;
|
||||
setEnumData<YGEdge>(flags, edgesOffset, (YGEdge) edge);
|
||||
setEnumData<YGEdge>(flags, edgesOffset, (YGEdge)edge);
|
||||
|
||||
ASSERT_EQ(getEnumData<YGAlign>(flags, alignOffset), 0);
|
||||
ASSERT_EQ(getBooleanData(flags, boolOffset), false);
|
||||
|
@@ -44,8 +44,8 @@ static YGNodeRef createYGNode(
|
||||
if (alignBaseline) {
|
||||
YGNodeStyleSetAlignItems(node, YGAlignBaseline);
|
||||
}
|
||||
YGNodeStyleSetWidth(node, (float) width);
|
||||
YGNodeStyleSetHeight(node, (float) height);
|
||||
YGNodeStyleSetWidth(node, (float)width);
|
||||
YGNodeStyleSetHeight(node, (float)height);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@@ -8,11 +8,9 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
static float _baseline(
|
||||
YGNodeConstRef node,
|
||||
const float /*width*/,
|
||||
const float /*height*/) {
|
||||
float* baseline = (float*) YGNodeGetContext(node);
|
||||
static float
|
||||
_baseline(YGNodeConstRef node, const float /*width*/, const float /*height*/) {
|
||||
float* baseline = (float*)YGNodeGetContext(node);
|
||||
return *baseline;
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
using namespace facebook;
|
||||
|
||||
static void _dirtied(YGNodeConstRef node) {
|
||||
int* dirtiedCount = (int*) YGNodeGetContext(node);
|
||||
int* dirtiedCount = (int*)YGNodeGetContext(node);
|
||||
(*dirtiedCount)++;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
using namespace ::testing;
|
||||
|
||||
class YogaTest_HadOverflowTests : public Test {
|
||||
protected:
|
||||
protected:
|
||||
YogaTest_HadOverflowTests() {
|
||||
config = YGConfigNew();
|
||||
root = YGNodeNewWithConfig(config);
|
||||
|
@@ -75,7 +75,7 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -99,7 +99,7 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -122,7 +122,7 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
|
@@ -14,7 +14,7 @@ static YGSize _measureMax(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*)YGNodeGetContext(node);
|
||||
(*measureCount)++;
|
||||
|
||||
return YGSize{
|
||||
@@ -29,7 +29,7 @@ static YGSize _measureMin(
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*)YGNodeGetContext(node);
|
||||
*measureCount = *measureCount + 1;
|
||||
return YGSize{
|
||||
widthMode == YGMeasureModeUndefined ||
|
||||
@@ -49,7 +49,7 @@ static YGSize _measure_84_49(
|
||||
YGMeasureMode /*widthMode*/,
|
||||
float /*height*/,
|
||||
YGMeasureMode /*heightMode*/) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*)YGNodeGetContext(node);
|
||||
if (measureCount) {
|
||||
(*measureCount)++;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ static YGSize _measure(
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
struct _MeasureConstraintList* constraintList =
|
||||
(struct _MeasureConstraintList*) YGNodeGetContext(node);
|
||||
(struct _MeasureConstraintList*)YGNodeGetContext(node);
|
||||
struct _MeasureConstraint* constraints = constraintList->constraints;
|
||||
uint32_t currentIndex = constraintList->length;
|
||||
(&constraints[currentIndex])->width = width;
|
||||
@@ -45,7 +45,7 @@ static YGSize _measure(
|
||||
TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -72,7 +72,7 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||
TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||
TEST(YogaTest, at_most_main_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST(YogaTest, at_most_main_axis_column) {
|
||||
TEST(YogaTest, at_most_cross_axis_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -155,7 +155,7 @@ TEST(YogaTest, at_most_cross_axis_column) {
|
||||
TEST(YogaTest, at_most_main_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -183,7 +183,7 @@ TEST(YogaTest, at_most_main_axis_row) {
|
||||
TEST(YogaTest, at_most_cross_axis_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ TEST(YogaTest, at_most_cross_axis_row) {
|
||||
TEST(YogaTest, flex_child) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -242,7 +242,7 @@ TEST(YogaTest, flex_child) {
|
||||
TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -270,7 +270,7 @@ TEST(YogaTest, flex_child_with_flex_basis) {
|
||||
TEST(YogaTest, overflow_scroll_column) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
@@ -302,7 +302,7 @@ TEST(YogaTest, overflow_scroll_column) {
|
||||
TEST(YogaTest, overflow_scroll_row) {
|
||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||
0,
|
||||
(struct _MeasureConstraint*) malloc(
|
||||
(struct _MeasureConstraint*)malloc(
|
||||
10 * sizeof(struct _MeasureConstraint)),
|
||||
};
|
||||
|
||||
|
@@ -14,7 +14,7 @@ static YGSize _measure(
|
||||
YGMeasureMode /*widthMode*/,
|
||||
float /*height*/,
|
||||
YGMeasureMode /*heightMode*/) {
|
||||
int* measureCount = (int*) YGNodeGetContext(node);
|
||||
int* measureCount = (int*)YGNodeGetContext(node);
|
||||
if (measureCount) {
|
||||
(*measureCount)++;
|
||||
}
|
||||
@@ -645,7 +645,6 @@ static YGSize _measure_90_10(
|
||||
YGMeasureMode /*widthMode*/,
|
||||
float /*height*/,
|
||||
YGMeasureMode /*heightMode*/) {
|
||||
|
||||
return YGSize{90, 10};
|
||||
}
|
||||
|
||||
@@ -655,7 +654,6 @@ static YGSize _measure_100_100(
|
||||
YGMeasureMode /*widthMode*/,
|
||||
float /*height*/,
|
||||
YGMeasureMode /*heightMode*/) {
|
||||
|
||||
return YGSize{100, 100};
|
||||
}
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/Yoga-internal.h>
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
TEST(YogaTest, rounding_value) {
|
||||
// Test that whole numbers are rounded to whole despite ceil/floor flags
|
||||
@@ -70,7 +70,7 @@ TEST(YogaTest, consistent_rounding_during_repeated_layouts) {
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
// Dirty the tree so YGRoundToPixelGrid runs again
|
||||
YGNodeStyleSetMargin(root, YGEdgeLeft, (float) (i + 1));
|
||||
YGNodeStyleSetMargin(root, YGEdgeLeft, (float)(i + 1));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(node1));
|
||||
|
@@ -5,11 +5,11 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <gtest/gtest.h>
|
||||
#include <yoga/Yoga.h>
|
||||
#include <yoga/style/Style.h>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
|
||||
#define ACCESSOR_TESTS_1(NAME, X) \
|
||||
style.NAME() = X; \
|
||||
|
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "TestUtil.h"
|
||||
|
||||
#include <yoga/node/Node.h>
|
||||
#include <yoga/event/event.h>
|
||||
#include <yoga/node/Node.h>
|
||||
|
||||
namespace facebook::yoga::test {
|
||||
|
||||
@@ -20,7 +20,6 @@ void yogaEventSubscriber(
|
||||
YGNodeConstRef /*node*/,
|
||||
Event::Type eventType,
|
||||
const Event::Data& /*eventData*/) {
|
||||
|
||||
switch (eventType) {
|
||||
case Event::NodeAllocation:
|
||||
nodeInstanceCount++;
|
||||
|
Reference in New Issue
Block a user