Format C/C++ files

Summary: Run new `format.sh`.

Reviewed By: emilsjolander

Differential Revision: D4481501

fbshipit-source-id: 5791bee9919b44282d1549029ff8e078f253ddf8
This commit is contained in:
Pascal Hartig
2017-01-31 09:28:10 -08:00
committed by Facebook Github Bot
parent 9afb65da34
commit 326ae15532
22 changed files with 138 additions and 144 deletions

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#import <UIKit/UIKit.h>
#import "YGLayout.h" #import "YGLayout.h"
#import <UIKit/UIKit.h>
@interface UIView (Yoga) @interface UIView (Yoga)

View File

@@ -18,7 +18,8 @@
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout; @property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
/** /**
The property that decides during layout/sizing whether or not styling properties should be applied. Defaults to NO. The property that decides during layout/sizing whether or not styling properties should be applied.
Defaults to NO.
*/ */
@property (nonatomic, readwrite, assign, setter=setEnabled:) BOOL isEnabled; @property (nonatomic, readwrite, assign, setter=setEnabled:) BOOL isEnabled;
@@ -84,7 +85,7 @@
/** /**
Get the resolved direction of this node. This won't be YGDirectionInherit Get the resolved direction of this node. This won't be YGDirectionInherit
*/ */
@property (nonatomic, readonly, assign) YGDirection resolvedDirection; @property (nonatomic, readonly, assign) YGDirection resolvedDirection;
/** /**
Perform a layout calculation and update the frames of the views in the hierarchy with the results Perform a layout calculation and update the frames of the views in the hierarchy with the results
@@ -92,19 +93,21 @@
- (void)applyLayout NS_SWIFT_NAME(applyLayout()); - (void)applyLayout NS_SWIFT_NAME(applyLayout());
/** /**
Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; Returns the size of the view if no constraints were given. This could equivalent to calling [self
sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
*/ */
@property (nonatomic, readonly, assign) CGSize intrinsicSize; @property (nonatomic, readonly, assign) CGSize intrinsicSize;
/** /**
Returns the number of children that are using Flexbox. Returns the number of children that are using Flexbox.
*/ */
@property (nonatomic, readonly, assign) NSUInteger numberOfChildren; @property (nonatomic, readonly, assign) NSUInteger numberOfChildren;
/** /**
Return a BOOL indiciating whether or not we this node contains any subviews that are included in Yoga's layout. Return a BOOL indiciating whether or not we this node contains any subviews that are included in
Yoga's layout.
*/ */
@property (nonatomic, readonly, assign) BOOL isLeaf; @property (nonatomic, readonly, assign) BOOL isLeaf;
/** /**
Mark that a view's layout needs to be recalculated. Only works for leaf views. Mark that a view's layout needs to be recalculated. Only works for leaf views.

View File

@@ -13,4 +13,3 @@
@property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UIWindow *window;
@end @end

View File

@@ -10,6 +10,4 @@
@interface ViewController : UIViewController @interface ViewController : UIViewController
@end @end

View File

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

View File

@@ -17,7 +17,7 @@
#define NUM_REPETITIONS 1000 #define NUM_REPETITIONS 1000
#define YGBENCHMARKS(BLOCK) \ #define YGBENCHMARKS(BLOCK) \
int main(int argc, char const *argv[]) { \ int main(int argc, char const *argv[]) { \
clock_t __start; \ clock_t __start; \
clock_t __endTimes[NUM_REPETITIONS]; \ clock_t __endTimes[NUM_REPETITIONS]; \
@@ -25,7 +25,7 @@
return 0; \ return 0; \
} }
#define YGBENCHMARK(NAME, BLOCK) \ #define YGBENCHMARK(NAME, BLOCK) \
__start = clock(); \ __start = clock(); \
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \ for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
{ BLOCK } \ { BLOCK } \

View File

@@ -10,18 +10,13 @@
// dllmain.cpp : Defines the entry point for the DLL application. // dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h" #include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule, BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
DWORD ul_reason_for_call, switch (ul_reason_for_call) {
LPVOID lpReserved case DLL_PROCESS_ATTACH:
) case DLL_THREAD_ATTACH:
{ case DLL_THREAD_DETACH:
switch (ul_reason_for_call) case DLL_PROCESS_DETACH:
{ break;
case DLL_PROCESS_ATTACH: }
case DLL_THREAD_ATTACH: return TRUE;
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
} }

View File

@@ -6,9 +6,9 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@@ -16,10 +16,8 @@
#include "targetver.h" #include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files: // Windows Header Files:
#include <windows.h> #include <windows.h>
// TODO: reference additional headers your program requires here // TODO: reference additional headers your program requires here

View File

@@ -7,15 +7,15 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
static YGSize _measure(YGNodeRef node, static YGSize _measure(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
return YGSize { return YGSize{
.width = widthMode == YGMeasureModeExactly ? width : 50, .width = widthMode == YGMeasureModeExactly ? width : 50,
.height = heightMode == YGMeasureModeExactly ? height : 50, .height = heightMode == YGMeasureModeExactly ? height : 50,
}; };

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, computed_layout_margin) { TEST(YogaTest, computed_layout_margin) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, computed_layout_padding) { TEST(YogaTest, computed_layout_padding) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, assert_default_values) { TEST(YogaTest, assert_default_values) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, dirty_propagation) { TEST(YogaTest, dirty_propagation) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, start_overrides) { TEST(YogaTest, start_overrides) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,51 +7,54 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
static YGSize _measureMax(YGNodeRef node, static YGSize _measureMax(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int *) YGNodeGetContext(node);
int *measureCount = (int *)YGNodeGetContext(node);
(*measureCount)++; (*measureCount)++;
return YGSize { return YGSize{
.width = widthMode == YGMeasureModeUndefined ? 10 : width, .width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == YGMeasureModeUndefined ? 10 : height, .height = heightMode == YGMeasureModeUndefined ? 10 : height,
}; };
} }
static YGSize _measureMin(YGNodeRef node, static YGSize _measureMin(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int *) YGNodeGetContext(node);
int *measureCount = (int *)YGNodeGetContext(node);
*measureCount = *measureCount + 1; *measureCount = *measureCount + 1;
return YGSize { return YGSize{
.width = widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10) ? 10 : width, .width =
.height = heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10) ? 10 : height, widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10)
? 10
: width,
.height =
heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10)
? 10
: height,
}; };
} }
static YGSize _measure_84_49(YGNodeRef node, static YGSize _measure_84_49(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int*) YGNodeGetContext(node); int *measureCount = (int *) YGNodeGetContext(node);
if (measureCount) { if (measureCount) {
(*measureCount)++; (*measureCount)++;
} }
return YGSize { return YGSize{
.width = 84.f, .width = 84.f, .height = 49.f,
.height = 49.f,
}; };
} }
@@ -155,19 +158,19 @@ TEST(YogaTest, remeasure_with_already_measured_value_smaller_but_still_float_equ
YGNodeStyleSetWidth(root, 288.f); YGNodeStyleSetWidth(root, 288.f);
YGNodeStyleSetHeight(root, 288.f); YGNodeStyleSetHeight(root, 288.f);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
const YGNodeRef root_child0 = YGNodeNew(); const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetPadding(root_child0, YGEdgeAll, 2.88f); YGNodeStyleSetPadding(root_child0, YGEdgeAll, 2.88f);
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
YGNodeInsertChild(root, root_child0, 0); YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew(); const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeSetContext(root_child0_child0, &measureCount); YGNodeSetContext(root_child0_child0, &measureCount);
YGNodeSetMeasureFunc(root_child0_child0, _measure_84_49); YGNodeSetMeasureFunc(root_child0_child0, _measure_84_49);
YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeInsertChild(root_child0, root_child0_child0, 0);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
YGNodeFreeRecursive(root); YGNodeFreeRecursive(root);
ASSERT_EQ(1, measureCount); ASSERT_EQ(1, measureCount);

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
struct _MeasureConstraint { struct _MeasureConstraint {
float width; float width;
@@ -23,11 +23,12 @@ struct _MeasureConstraintList {
}; };
static YGSize _measure(YGNodeRef node, static YGSize _measure(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
struct _MeasureConstraintList *constraintList = (struct _MeasureConstraintList *)YGNodeGetContext(node); struct _MeasureConstraintList *constraintList =
(struct _MeasureConstraintList *) YGNodeGetContext(node);
struct _MeasureConstraint *constraints = constraintList->constraints; struct _MeasureConstraint *constraints = constraintList->constraints;
uint32_t currentIndex = constraintList->length; uint32_t currentIndex = constraintList->length;
(&constraints[currentIndex])->width = width; (&constraints[currentIndex])->width = width;
@@ -36,16 +37,16 @@ static YGSize _measure(YGNodeRef node,
(&constraints[currentIndex])->heightMode = heightMode; (&constraints[currentIndex])->heightMode = heightMode;
constraintList->length = currentIndex + 1; constraintList->length = currentIndex + 1;
return YGSize { return YGSize{
.width = widthMode == YGMeasureModeUndefined ? 10 : width, .width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == YGMeasureModeUndefined ? 10 : width, .height = heightMode == YGMeasureModeUndefined ? 10 : width,
}; };
} }
TEST(YogaTest, exactly_measure_stretched_child_column) { TEST(YogaTest, exactly_measure_stretched_child_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -69,9 +70,9 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
} }
TEST(YogaTest, exactly_measure_stretched_child_row) { TEST(YogaTest, exactly_measure_stretched_child_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -96,9 +97,9 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
} }
TEST(YogaTest, at_most_main_axis_column) { TEST(YogaTest, at_most_main_axis_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -122,9 +123,9 @@ TEST(YogaTest, at_most_main_axis_column) {
} }
TEST(YogaTest, at_most_cross_axis_column) { TEST(YogaTest, at_most_cross_axis_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -149,9 +150,9 @@ TEST(YogaTest, at_most_cross_axis_column) {
} }
TEST(YogaTest, at_most_main_axis_row) { TEST(YogaTest, at_most_main_axis_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -176,9 +177,9 @@ TEST(YogaTest, at_most_main_axis_row) {
} }
TEST(YogaTest, at_most_cross_axis_row) { TEST(YogaTest, at_most_cross_axis_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -204,9 +205,9 @@ TEST(YogaTest, at_most_cross_axis_row) {
} }
TEST(YogaTest, flex_child) { TEST(YogaTest, flex_child) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -233,9 +234,9 @@ TEST(YogaTest, flex_child) {
} }
TEST(YogaTest, flex_child_with_flex_basis) { TEST(YogaTest, flex_child_with_flex_basis) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -260,9 +261,9 @@ TEST(YogaTest, flex_child_with_flex_basis) {
} }
TEST(YogaTest, overflow_scroll_column) { TEST(YogaTest, overflow_scroll_column) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
@@ -291,9 +292,9 @@ TEST(YogaTest, overflow_scroll_column) {
} }
TEST(YogaTest, overflow_scroll_row) { TEST(YogaTest, overflow_scroll_row) {
struct _MeasureConstraintList constraintList = _MeasureConstraintList { struct _MeasureConstraintList constraintList = _MeasureConstraintList{
.length = 0, .length = 0,
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)), .constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
}; };
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();

View File

@@ -7,22 +7,21 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
static YGSize _measure(YGNodeRef node, static YGSize _measure(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int*) YGNodeGetContext(node); int *measureCount = (int *) YGNodeGetContext(node);
if (measureCount) { if (measureCount) {
(*measureCount)++; (*measureCount)++;
} }
return YGSize { return YGSize{
.width = 10, .width = 10, .height = 10,
.height = 10,
}; };
} }

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
extern int32_t gNodeInstanceCount; extern int32_t gNodeInstanceCount;
@@ -66,12 +66,14 @@ TEST(YogaTest, memory_func_test_funcs) {
TEST(YogaTest, memory_func_assert_zero_nodes) { TEST(YogaTest, memory_func_assert_zero_nodes) {
gNodeInstanceCount = 0; // Reset YGNode instance count for memory func test gNodeInstanceCount = 0; // Reset YGNode instance count for memory func test
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
ASSERT_DEATH(YGSetMemoryFuncs(&testMalloc, &testCalloc, &testRealloc, &testFree), "Cannot set memory functions: all node must be freed first"); ASSERT_DEATH(YGSetMemoryFuncs(&testMalloc, &testCalloc, &testRealloc, &testFree),
"Cannot set memory functions: all node must be freed first");
YGNodeFreeRecursive(root); YGNodeFreeRecursive(root);
} }
TEST(YogaTest, memory_func_assert_all_non_null) { TEST(YogaTest, memory_func_assert_all_non_null) {
gNodeInstanceCount = 0; // Reset YGNode instance count for memory func test gNodeInstanceCount = 0; // Reset YGNode instance count for memory func test
ASSERT_DEATH(YGSetMemoryFuncs(NULL, &testCalloc, &testRealloc, &testFree), "Cannot set memory functions: functions must be all NULL or Non-NULL"); ASSERT_DEATH(YGSetMemoryFuncs(NULL, &testCalloc, &testRealloc, &testFree),
"Cannot set memory functions: functions must be all NULL or Non-NULL");
} }
#endif #endif

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) { TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true); YGSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true);

View File

@@ -7,30 +7,26 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
static YGSize _measureFloor(YGNodeRef node, static YGSize _measureFloor(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
return YGSize{ return YGSize{
width = 10.2f, width = 10.2f, height = 10.2f,
height = 10.2f,
}; };
} }
static YGSize _measureCeil(YGNodeRef node, static YGSize _measureCeil(YGNodeRef node,
float width, float width,
YGMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
YGMeasureMode heightMode) { YGMeasureMode heightMode) {
return YGSize{ return YGSize{
width = 10.5, width = 10.5, height = 10.5,
height = 10.5,
}; };
} }

View File

@@ -7,8 +7,8 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#include <yoga/Yoga.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <yoga/Yoga.h>
TEST(YogaTest, copy_style_same) { TEST(YogaTest, copy_style_same) {
const YGNodeRef node0 = YGNodeNew(); const YGNodeRef node0 = YGNodeNew();