From 85352c4e45f1a2950ada532e572ebd4b2c4b293c Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 25 Mar 2019 05:37:36 -0700 Subject: [PATCH] Automatic lint fixes Summary: @public A round of automatic lint fixes. Reviewed By: SidharthGuglani Differential Revision: D14590396 fbshipit-source-id: f0b4a0ce503a1d9d46ea7ae788f9f2eac09c2ac7 --- .../samples/yoga/BenchmarkActivity.java | 8 +- .../samples/yoga/BenchmarkAggregator.java | 8 +- .../samples/yoga/BenchmarkFragment.java | 8 +- .../samples/yoga/BenchmarkInflate.java | 8 +- .../samples/yoga/BenchmarkLayout.java | 8 +- .../samples/yoga/BenchmarkMeasure.java | 8 +- .../facebook/samples/yoga/MainActivity.java | 8 +- .../yoga/android/VirtualYogaLayout.java | 5 +- .../com/facebook/yoga/android/YogaLayout.java | 5 +- .../yoga/android/YogaViewLayoutFactory.java | 5 +- .../proguard/annotations/DoNotStrip.java | 5 +- .../facebook/yoga/TestParametrization.java | 9 +- .../facebook/yoga/YGAbsolutePositionTest.java | 5 +- .../facebook/yoga/YGAlignBaselineTest.java | 4 +- .../com/facebook/yoga/YGAlignContentTest.java | 5 +- .../com/facebook/yoga/YGAlignItemsTest.java | 5 +- .../com/facebook/yoga/YGAlignSelfTest.java | 5 +- .../com/facebook/yoga/YGAndroidNewsFeed.java | 5 +- .../tests/com/facebook/yoga/YGBorderTest.java | 5 +- .../com/facebook/yoga/YGDimensionTest.java | 5 +- .../com/facebook/yoga/YGDisplayTest.java | 5 +- .../facebook/yoga/YGFlexDirectionTest.java | 5 +- java/tests/com/facebook/yoga/YGFlexTest.java | 4 +- .../com/facebook/yoga/YGFlexWrapTest.java | 5 +- .../facebook/yoga/YGJustifyContentTest.java | 4 +- .../tests/com/facebook/yoga/YGMarginTest.java | 5 +- .../facebook/yoga/YGMinMaxDimensionTest.java | 5 +- .../com/facebook/yoga/YGPaddingTest.java | 5 +- .../com/facebook/yoga/YGPercentageTest.java | 5 +- .../com/facebook/yoga/YGRoundingTest.java | 5 +- .../com/facebook/yoga/YGSizeOverflowTest.java | 5 +- .../com/facebook/yoga/YogaLoggerTest.java | 5 +- .../com/facebook/yoga/YogaValueTest.java | 5 +- javascript/sources/Config.cc | 37 +- javascript/sources/Config.hh | 49 +- javascript/sources/Layout.hh | 27 +- javascript/sources/Node.cc | 536 ++++++++---------- javascript/sources/Node.hh | 265 ++++----- javascript/sources/Size.hh | 31 +- javascript/sources/Value.hh | 38 +- javascript/sources/global.cc | 5 +- javascript/sources/global.hh | 5 +- javascript/sources/nbind.cc | 218 ++++--- tests/CompactValueTest.cpp | 4 +- tests/YGAbsolutePositionTest.cpp | 23 +- tests/YGAlignBaselineTest.cpp | 6 +- tests/YGAlignContentTest.cpp | 3 +- tests/YGAspectRatioTest.cpp | 11 +- tests/YGBaselineFuncTest.cpp | 2 +- tests/YGDefaultValuesTest.cpp | 6 +- tests/YGDirtiedTest.cpp | 2 +- tests/YGFlexDirectionTest.cpp | 3 +- tests/YGHadOverflowTest.cpp | 8 +- tests/YGInfiniteHeightTest.cpp | 3 +- tests/YGLoggerTest.cpp | 63 +- tests/YGMeasureCacheTest.cpp | 62 +- tests/YGMeasureModeTest.cpp | 47 +- tests/YGMinMaxDimensionTest.cpp | 3 +- tests/YGPercentageTest.cpp | 4 +- tests/YGRelayoutTest.cpp | 3 +- tests/YGRoundingFunctionTest.cpp | 3 +- tests/YGRoundingMeasureFuncTest.cpp | 46 +- tests/YGSizeOverflowTest.cpp | 3 +- tests/YGTraversalTest.cpp | 17 +- tests/YGTreeMutationTest.cpp | 27 +- yoga/log.cpp | 1 - 66 files changed, 832 insertions(+), 916 deletions(-) diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkActivity.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkActivity.java index ba09f51b3c..03f96d2bda 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkActivity.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkActivity.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; import android.content.Intent; diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkAggregator.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkAggregator.java index 2fc57896fb..35a77342c6 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkAggregator.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkAggregator.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; import java.io.File; diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkFragment.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkFragment.java index bc69229049..5c4698a07f 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkFragment.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkFragment.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkInflate.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkInflate.java index b3a24474b2..5eb413ae53 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkInflate.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkInflate.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; import android.os.Bundle; diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkLayout.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkLayout.java index 8fdcdb64a3..72cd6ba50f 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkLayout.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkLayout.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; import android.os.Bundle; diff --git a/android/sample/java/com/facebook/samples/yoga/BenchmarkMeasure.java b/android/sample/java/com/facebook/samples/yoga/BenchmarkMeasure.java index 51151878d4..3ed670ee55 100644 --- a/android/sample/java/com/facebook/samples/yoga/BenchmarkMeasure.java +++ b/android/sample/java/com/facebook/samples/yoga/BenchmarkMeasure.java @@ -1,5 +1,9 @@ -// Copyright 2004-present Facebook. All Rights Reserved. - +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + */ package com.facebook.samples.yoga; import android.os.Bundle; diff --git a/android/sample/java/com/facebook/samples/yoga/MainActivity.java b/android/sample/java/com/facebook/samples/yoga/MainActivity.java index 2410ca9598..686061053b 100644 --- a/android/sample/java/com/facebook/samples/yoga/MainActivity.java +++ b/android/sample/java/com/facebook/samples/yoga/MainActivity.java @@ -1,11 +1,9 @@ /** - * Copyright 2014-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the license found in the - * LICENSE-examples file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.samples.yoga; import android.content.Intent; diff --git a/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java b/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java index 8bb188e22f..c6b87e5e94 100644 --- a/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java +++ b/android/src/main/java/com/facebook/yoga/android/VirtualYogaLayout.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.yoga.android; import java.util.HashMap; diff --git a/android/src/main/java/com/facebook/yoga/android/YogaLayout.java b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java index 352a0ed383..92e2c86c30 100644 --- a/android/src/main/java/com/facebook/yoga/android/YogaLayout.java +++ b/android/src/main/java/com/facebook/yoga/android/YogaLayout.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.yoga.android; import android.content.Context; diff --git a/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java b/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java index c8698d0dc6..ee4e09c874 100644 --- a/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java +++ b/android/src/main/java/com/facebook/yoga/android/YogaViewLayoutFactory.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.yoga.android; import android.content.Context; diff --git a/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStrip.java b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStrip.java index 90be72b833..519fca344d 100644 --- a/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStrip.java +++ b/java/proguard-annotations/src/main/java/com/facebook/proguard/annotations/DoNotStrip.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.proguard.annotations; import java.lang.annotation.ElementType; diff --git a/java/tests/com/facebook/yoga/TestParametrization.java b/java/tests/com/facebook/yoga/TestParametrization.java index 53c49fbee4..0ae4723363 100644 --- a/java/tests/com/facebook/yoga/TestParametrization.java +++ b/java/tests/com/facebook/yoga/TestParametrization.java @@ -1,9 +1,8 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the LICENSE - * file in the root directory of this source tree. +/** + * Copyright (c) Facebook, Inc. and its affiliates. * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java index 92db607ccf..b3523e1074 100644 --- a/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java +++ b/java/tests/com/facebook/yoga/YGAbsolutePositionTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignBaselineTest.java b/java/tests/com/facebook/yoga/YGAlignBaselineTest.java index 46258b41b7..893d130bf3 100644 --- a/java/tests/com/facebook/yoga/YGAlignBaselineTest.java +++ b/java/tests/com/facebook/yoga/YGAlignBaselineTest.java @@ -1,8 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignContentTest.java b/java/tests/com/facebook/yoga/YGAlignContentTest.java index 5609ae23fa..bdc2c60ddb 100644 --- a/java/tests/com/facebook/yoga/YGAlignContentTest.java +++ b/java/tests/com/facebook/yoga/YGAlignContentTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignItemsTest.java b/java/tests/com/facebook/yoga/YGAlignItemsTest.java index 5bbe779527..f512715068 100644 --- a/java/tests/com/facebook/yoga/YGAlignItemsTest.java +++ b/java/tests/com/facebook/yoga/YGAlignItemsTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGAlignItemsTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAlignSelfTest.java b/java/tests/com/facebook/yoga/YGAlignSelfTest.java index d4ebbc66ee..c73ee981a3 100644 --- a/java/tests/com/facebook/yoga/YGAlignSelfTest.java +++ b/java/tests/com/facebook/yoga/YGAlignSelfTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGAlignSelfTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java b/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java index d4a8d3afd1..687518a274 100644 --- a/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java +++ b/java/tests/com/facebook/yoga/YGAndroidNewsFeed.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGAndroidNewsFeed.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGBorderTest.java b/java/tests/com/facebook/yoga/YGBorderTest.java index d0f0ba2e8c..8c76ae0d73 100644 --- a/java/tests/com/facebook/yoga/YGBorderTest.java +++ b/java/tests/com/facebook/yoga/YGBorderTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGBorderTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGDimensionTest.java b/java/tests/com/facebook/yoga/YGDimensionTest.java index 629870e85c..36f6dafdb8 100644 --- a/java/tests/com/facebook/yoga/YGDimensionTest.java +++ b/java/tests/com/facebook/yoga/YGDimensionTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGDimensionTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGDisplayTest.java b/java/tests/com/facebook/yoga/YGDisplayTest.java index c991d37dd4..0671d28ea2 100644 --- a/java/tests/com/facebook/yoga/YGDisplayTest.java +++ b/java/tests/com/facebook/yoga/YGDisplayTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGDisplayTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java index 489916a4ef..1299a48eb1 100644 --- a/java/tests/com/facebook/yoga/YGFlexDirectionTest.java +++ b/java/tests/com/facebook/yoga/YGFlexDirectionTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGFlexTest.java b/java/tests/com/facebook/yoga/YGFlexTest.java index 5ebc8abf11..e7a5f33bd5 100644 --- a/java/tests/com/facebook/yoga/YGFlexTest.java +++ b/java/tests/com/facebook/yoga/YGFlexTest.java @@ -1,8 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGFlexTest.html diff --git a/java/tests/com/facebook/yoga/YGFlexWrapTest.java b/java/tests/com/facebook/yoga/YGFlexWrapTest.java index 6528714daa..3f46dffda7 100644 --- a/java/tests/com/facebook/yoga/YGFlexWrapTest.java +++ b/java/tests/com/facebook/yoga/YGFlexWrapTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGFlexWrapTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGJustifyContentTest.java b/java/tests/com/facebook/yoga/YGJustifyContentTest.java index 1f7442c84d..070aa32fb1 100644 --- a/java/tests/com/facebook/yoga/YGJustifyContentTest.java +++ b/java/tests/com/facebook/yoga/YGJustifyContentTest.java @@ -1,8 +1,8 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGJustifyContentTest.html diff --git a/java/tests/com/facebook/yoga/YGMarginTest.java b/java/tests/com/facebook/yoga/YGMarginTest.java index 3c62d3d60e..2795aa3383 100644 --- a/java/tests/com/facebook/yoga/YGMarginTest.java +++ b/java/tests/com/facebook/yoga/YGMarginTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGMarginTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java b/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java index 60945034d3..c70393110f 100644 --- a/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java +++ b/java/tests/com/facebook/yoga/YGMinMaxDimensionTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGPaddingTest.java b/java/tests/com/facebook/yoga/YGPaddingTest.java index 3679d4a2e7..aa9ad398d2 100644 --- a/java/tests/com/facebook/yoga/YGPaddingTest.java +++ b/java/tests/com/facebook/yoga/YGPaddingTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGPaddingTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGPercentageTest.java b/java/tests/com/facebook/yoga/YGPercentageTest.java index a433fac6c6..88aa947ef6 100644 --- a/java/tests/com/facebook/yoga/YGPercentageTest.java +++ b/java/tests/com/facebook/yoga/YGPercentageTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGPercentageTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGRoundingTest.java b/java/tests/com/facebook/yoga/YGRoundingTest.java index 64b8a124f4..2b23f9e483 100644 --- a/java/tests/com/facebook/yoga/YGRoundingTest.java +++ b/java/tests/com/facebook/yoga/YGRoundingTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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/YGRoundingTest.html package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YGSizeOverflowTest.java b/java/tests/com/facebook/yoga/YGSizeOverflowTest.java index 804282b7c4..ce342bbb27 100644 --- a/java/tests/com/facebook/yoga/YGSizeOverflowTest.java +++ b/java/tests/com/facebook/yoga/YGSizeOverflowTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * 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 package com.facebook.yoga; diff --git a/java/tests/com/facebook/yoga/YogaLoggerTest.java b/java/tests/com/facebook/yoga/YogaLoggerTest.java index b6b9885ebd..3350d97006 100644 --- a/java/tests/com/facebook/yoga/YogaLoggerTest.java +++ b/java/tests/com/facebook/yoga/YogaLoggerTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.yoga; import org.junit.Test; diff --git a/java/tests/com/facebook/yoga/YogaValueTest.java b/java/tests/com/facebook/yoga/YogaValueTest.java index 9f17a8928a..fa09c5044b 100644 --- a/java/tests/com/facebook/yoga/YogaValueTest.java +++ b/java/tests/com/facebook/yoga/YogaValueTest.java @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - package com.facebook.yoga; import org.junit.Test; diff --git a/javascript/sources/Config.cc b/javascript/sources/Config.cc index 60e5bafc68..675ccfe08f 100644 --- a/javascript/sources/Config.cc +++ b/javascript/sources/Config.cc @@ -8,37 +8,30 @@ #include "./Config.hh" -/* static */ Config * Config::create(void) -{ - return new Config(); +/* static */ Config* Config::create(void) { + return new Config(); } -/* static */ void Config::destroy(Config * node) -{ - delete node; +/* static */ void Config::destroy(Config* node) { + delete node; } -Config::Config(void) -: m_config(YGConfigNew()) -{ -} +Config::Config(void) : m_config(YGConfigNew()) {} -Config::~Config(void) -{ - YGConfigFree(m_config); +Config::~Config(void) { + YGConfigFree(m_config); } -void Config::setExperimentalFeatureEnabled(int feature, bool enabled) -{ - YGConfigSetExperimentalFeatureEnabled(m_config, static_cast(feature), enabled); +void Config::setExperimentalFeatureEnabled(int feature, bool enabled) { + YGConfigSetExperimentalFeatureEnabled( + m_config, static_cast(feature), enabled); } -void Config::setPointScaleFactor(float pixelsInPoint) -{ - YGConfigSetPointScaleFactor(m_config, pixelsInPoint); +void Config::setPointScaleFactor(float pixelsInPoint) { + YGConfigSetPointScaleFactor(m_config, pixelsInPoint); } -bool Config::isExperimentalFeatureEnabled(int feature) const -{ - return YGConfigIsExperimentalFeatureEnabled(m_config, static_cast(feature)); +bool Config::isExperimentalFeatureEnabled(int feature) const { + return YGConfigIsExperimentalFeatureEnabled( + m_config, static_cast(feature)); } diff --git a/javascript/sources/Config.hh b/javascript/sources/Config.hh index e851971916..a1b751318f 100644 --- a/javascript/sources/Config.hh +++ b/javascript/sources/Config.hh @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once #include @@ -13,39 +12,31 @@ class Config { - friend class Node; - - public: - - static Config * create(void); - - static void destroy(Config * config); - - private: - - Config(void); - - public: - - ~Config(void); + friend class Node; - public: // Prevent accidental copy +public: + static Config* create(void); - Config(Config const &) = delete; + static void destroy(Config* config); - Config const & operator=(Config const &) = delete; +private: + Config(void); - public: // Setters +public: + ~Config(void); - void setExperimentalFeatureEnabled(int feature, bool enabled); - void setPointScaleFactor(float pixelsInPoint); - - public: // Getters +public: // Prevent accidental copy + Config(Config const&) = delete; - bool isExperimentalFeatureEnabled(int feature) const; + Config const& operator=(Config const&) = delete; - private: +public: // Setters + void setExperimentalFeatureEnabled(int feature, bool enabled); + void setPointScaleFactor(float pixelsInPoint); - YGConfigRef m_config; +public: // Getters + bool isExperimentalFeatureEnabled(int feature) const; +private: + YGConfigRef m_config; }; diff --git a/javascript/sources/Layout.hh b/javascript/sources/Layout.hh index 5cd135b38a..c222236d6b 100644 --- a/javascript/sources/Layout.hh +++ b/javascript/sources/Layout.hh @@ -1,28 +1,25 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once #include #include -struct Layout -{ - double left; - double right; +struct Layout { + double left; + double right; - double top; - double bottom; + double top; + double bottom; - double width; - double height; + double width; + double height; - void toJS(nbind::cbOutput expose) const - { - expose(left, right, top, bottom, width, height); - } + void toJS(nbind::cbOutput expose) const { + expose(left, right, top, bottom, width, height); + } }; diff --git a/javascript/sources/Node.cc b/javascript/sources/Node.cc index 748a6cd01b..f49c22790b 100644 --- a/javascript/sources/Node.cc +++ b/javascript/sources/Node.cc @@ -13,521 +13,445 @@ #include "./Size.hh" #include "./Config.hh" -static YGSize globalMeasureFunc(YGNodeRef nodeRef, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) -{ - Node const & node = *reinterpret_cast(YGNodeGetContext(nodeRef)); +static YGSize globalMeasureFunc( + YGNodeRef nodeRef, + float width, + YGMeasureMode widthMode, + float height, + YGMeasureMode heightMode) { + Node const& node = *reinterpret_cast(YGNodeGetContext(nodeRef)); - Size size = node.callMeasureFunc(width, widthMode, height, heightMode); - YGSize ygSize = { static_cast(size.width), static_cast(size.height) }; + Size size = node.callMeasureFunc(width, widthMode, height, heightMode); + YGSize ygSize = {static_cast(size.width), + static_cast(size.height)}; - return ygSize; + return ygSize; } -static void globalDirtiedFunc(YGNodeRef nodeRef) -{ - Node const & node = *reinterpret_cast(YGNodeGetContext(nodeRef)); +static void globalDirtiedFunc(YGNodeRef nodeRef) { + Node const& node = *reinterpret_cast(YGNodeGetContext(nodeRef)); - node.callDirtiedFunc(); + node.callDirtiedFunc(); } -/* static */ Node * Node::createDefault(void) -{ - return new Node(nullptr); +/* static */ Node* Node::createDefault(void) { + return new Node(nullptr); } -/* static */ Node * Node::createWithConfig(Config * config) -{ - return new Node(config); +/* static */ Node* Node::createWithConfig(Config* config) { + return new Node(config); } -/* static */ void Node::destroy(Node * node) -{ - delete node; +/* static */ void Node::destroy(Node* node) { + delete node; } -/* static */ Node * Node::fromYGNode(YGNodeRef nodeRef) -{ - return reinterpret_cast(YGNodeGetContext(nodeRef)); +/* static */ Node* Node::fromYGNode(YGNodeRef nodeRef) { + return reinterpret_cast(YGNodeGetContext(nodeRef)); } -Node::Node(Config * config) -: m_node(config != nullptr ? YGNodeNewWithConfig(config->m_config) : YGNodeNew()) -, m_measureFunc(nullptr) -, m_dirtiedFunc(nullptr) -{ - YGNodeSetContext(m_node, reinterpret_cast(this)); +Node::Node(Config* config) + : m_node( + config != nullptr ? YGNodeNewWithConfig(config->m_config) + : YGNodeNew()), + m_measureFunc(nullptr), + m_dirtiedFunc(nullptr) { + YGNodeSetContext(m_node, reinterpret_cast(this)); } -Node::~Node(void) -{ - YGNodeFree(m_node); +Node::~Node(void) { + YGNodeFree(m_node); } -void Node::reset(void) -{ - m_measureFunc.reset(nullptr); - m_dirtiedFunc.reset(nullptr); +void Node::reset(void) { + m_measureFunc.reset(nullptr); + m_dirtiedFunc.reset(nullptr); - YGNodeReset(m_node); + YGNodeReset(m_node); } -void Node::copyStyle(Node const & other) -{ - YGNodeCopyStyle(m_node, other.m_node); +void Node::copyStyle(Node const& other) { + YGNodeCopyStyle(m_node, other.m_node); } -void Node::setPositionType(int positionType) -{ - YGNodeStyleSetPositionType(m_node, static_cast(positionType)); +void Node::setPositionType(int positionType) { + YGNodeStyleSetPositionType(m_node, static_cast(positionType)); } -void Node::setPosition(int edge, double position) -{ - YGNodeStyleSetPosition(m_node, static_cast(edge), position); +void Node::setPosition(int edge, double position) { + YGNodeStyleSetPosition(m_node, static_cast(edge), position); } -void Node::setPositionPercent(int edge, double position) -{ - YGNodeStyleSetPositionPercent(m_node, static_cast(edge), position); +void Node::setPositionPercent(int edge, double position) { + YGNodeStyleSetPositionPercent(m_node, static_cast(edge), position); } -void Node::setAlignContent(int alignContent) -{ - YGNodeStyleSetAlignContent(m_node, static_cast(alignContent)); +void Node::setAlignContent(int alignContent) { + YGNodeStyleSetAlignContent(m_node, static_cast(alignContent)); } -void Node::setAlignItems(int alignItems) -{ - YGNodeStyleSetAlignItems(m_node, static_cast(alignItems)); +void Node::setAlignItems(int alignItems) { + YGNodeStyleSetAlignItems(m_node, static_cast(alignItems)); } -void Node::setAlignSelf(int alignSelf) -{ - YGNodeStyleSetAlignSelf(m_node, static_cast(alignSelf)); +void Node::setAlignSelf(int alignSelf) { + YGNodeStyleSetAlignSelf(m_node, static_cast(alignSelf)); } -void Node::setFlexDirection(int flexDirection) -{ - YGNodeStyleSetFlexDirection(m_node, static_cast(flexDirection)); +void Node::setFlexDirection(int flexDirection) { + YGNodeStyleSetFlexDirection( + m_node, static_cast(flexDirection)); } -void Node::setFlexWrap(int flexWrap) -{ - YGNodeStyleSetFlexWrap(m_node, static_cast(flexWrap)); +void Node::setFlexWrap(int flexWrap) { + YGNodeStyleSetFlexWrap(m_node, static_cast(flexWrap)); } -void Node::setJustifyContent(int justifyContent) -{ - YGNodeStyleSetJustifyContent(m_node, static_cast(justifyContent)); +void Node::setJustifyContent(int justifyContent) { + YGNodeStyleSetJustifyContent(m_node, static_cast(justifyContent)); } -void Node::setMargin(int edge, double margin) -{ - YGNodeStyleSetMargin(m_node, static_cast(edge), margin); +void Node::setMargin(int edge, double margin) { + YGNodeStyleSetMargin(m_node, static_cast(edge), margin); } -void Node::setMarginPercent(int edge, double margin) -{ - YGNodeStyleSetMarginPercent(m_node, static_cast(edge), margin); +void Node::setMarginPercent(int edge, double margin) { + YGNodeStyleSetMarginPercent(m_node, static_cast(edge), margin); } -void Node::setMarginAuto(int edge) -{ - YGNodeStyleSetMarginAuto(m_node, static_cast(edge)); +void Node::setMarginAuto(int edge) { + YGNodeStyleSetMarginAuto(m_node, static_cast(edge)); } -void Node::setOverflow(int overflow) -{ - YGNodeStyleSetOverflow(m_node, static_cast(overflow)); +void Node::setOverflow(int overflow) { + YGNodeStyleSetOverflow(m_node, static_cast(overflow)); } -void Node::setDisplay(int display) -{ - YGNodeStyleSetDisplay(m_node, static_cast(display)); +void Node::setDisplay(int display) { + YGNodeStyleSetDisplay(m_node, static_cast(display)); } -void Node::setFlex(double flex) -{ - YGNodeStyleSetFlex(m_node, flex); +void Node::setFlex(double flex) { + YGNodeStyleSetFlex(m_node, flex); } -void Node::setFlexBasis(double flexBasis) -{ - YGNodeStyleSetFlexBasis(m_node, flexBasis); +void Node::setFlexBasis(double flexBasis) { + YGNodeStyleSetFlexBasis(m_node, flexBasis); } -void Node::setFlexBasisPercent(double flexBasis) -{ - YGNodeStyleSetFlexBasisPercent(m_node, flexBasis); +void Node::setFlexBasisPercent(double flexBasis) { + YGNodeStyleSetFlexBasisPercent(m_node, flexBasis); } -void Node::setFlexGrow(double flexGrow) -{ - YGNodeStyleSetFlexGrow(m_node, flexGrow); +void Node::setFlexGrow(double flexGrow) { + YGNodeStyleSetFlexGrow(m_node, flexGrow); } -void Node::setFlexShrink(double flexShrink) -{ - YGNodeStyleSetFlexShrink(m_node, flexShrink); +void Node::setFlexShrink(double flexShrink) { + YGNodeStyleSetFlexShrink(m_node, flexShrink); } -void Node::setWidth(double width) -{ - YGNodeStyleSetWidth(m_node, width); +void Node::setWidth(double width) { + YGNodeStyleSetWidth(m_node, width); } -void Node::setWidthPercent(double width) -{ - YGNodeStyleSetWidthPercent(m_node, width); +void Node::setWidthPercent(double width) { + YGNodeStyleSetWidthPercent(m_node, width); } -void Node::setWidthAuto() -{ - YGNodeStyleSetWidthAuto(m_node); +void Node::setWidthAuto() { + YGNodeStyleSetWidthAuto(m_node); } -void Node::setHeight(double height) -{ - YGNodeStyleSetHeight(m_node, height); +void Node::setHeight(double height) { + YGNodeStyleSetHeight(m_node, height); } -void Node::setHeightPercent(double height) -{ - YGNodeStyleSetHeightPercent(m_node, height); +void Node::setHeightPercent(double height) { + YGNodeStyleSetHeightPercent(m_node, height); } -void Node::setHeightAuto() -{ - YGNodeStyleSetHeightAuto(m_node); +void Node::setHeightAuto() { + YGNodeStyleSetHeightAuto(m_node); } -void Node::setMinWidth(double minWidth) -{ - YGNodeStyleSetMinWidth(m_node, minWidth); +void Node::setMinWidth(double minWidth) { + YGNodeStyleSetMinWidth(m_node, minWidth); } -void Node::setMinWidthPercent(double minWidth) -{ - YGNodeStyleSetMinWidthPercent(m_node, minWidth); +void Node::setMinWidthPercent(double minWidth) { + YGNodeStyleSetMinWidthPercent(m_node, minWidth); } -void Node::setMinHeight(double minHeight) -{ - YGNodeStyleSetMinHeight(m_node, minHeight); +void Node::setMinHeight(double minHeight) { + YGNodeStyleSetMinHeight(m_node, minHeight); } -void Node::setMinHeightPercent(double minHeight) -{ - YGNodeStyleSetMinHeightPercent(m_node, minHeight); +void Node::setMinHeightPercent(double minHeight) { + YGNodeStyleSetMinHeightPercent(m_node, minHeight); } -void Node::setMaxWidth(double maxWidth) -{ - YGNodeStyleSetMaxWidth(m_node, maxWidth); +void Node::setMaxWidth(double maxWidth) { + YGNodeStyleSetMaxWidth(m_node, maxWidth); } -void Node::setMaxWidthPercent(double maxWidth) -{ - YGNodeStyleSetMaxWidthPercent(m_node, maxWidth); +void Node::setMaxWidthPercent(double maxWidth) { + YGNodeStyleSetMaxWidthPercent(m_node, maxWidth); } -void Node::setMaxHeight(double maxHeight) -{ - YGNodeStyleSetMaxHeight(m_node, maxHeight); +void Node::setMaxHeight(double maxHeight) { + YGNodeStyleSetMaxHeight(m_node, maxHeight); } -void Node::setMaxHeightPercent(double maxHeight) -{ - YGNodeStyleSetMaxHeightPercent(m_node, maxHeight); +void Node::setMaxHeightPercent(double maxHeight) { + YGNodeStyleSetMaxHeightPercent(m_node, maxHeight); } -void Node::setAspectRatio(double aspectRatio) -{ - YGNodeStyleSetAspectRatio(m_node, aspectRatio); +void Node::setAspectRatio(double aspectRatio) { + YGNodeStyleSetAspectRatio(m_node, aspectRatio); } -void Node::setBorder(int edge, double border) -{ - YGNodeStyleSetBorder(m_node, static_cast(edge), border); +void Node::setBorder(int edge, double border) { + YGNodeStyleSetBorder(m_node, static_cast(edge), border); } -void Node::setPadding(int edge, double padding) -{ - YGNodeStyleSetPadding(m_node, static_cast(edge), padding); +void Node::setPadding(int edge, double padding) { + YGNodeStyleSetPadding(m_node, static_cast(edge), padding); } -void Node::setPaddingPercent(int edge, double padding) -{ - YGNodeStyleSetPaddingPercent(m_node, static_cast(edge), padding); +void Node::setPaddingPercent(int edge, double padding) { + YGNodeStyleSetPaddingPercent(m_node, static_cast(edge), padding); } void Node::setIsReferenceBaseline(bool isReferenceBaseline) { YGNodeSetIsReferenceBaseline(m_node, isReferenceBaseline); } -int Node::getPositionType(void) const -{ - return YGNodeStyleGetPositionType(m_node); +int Node::getPositionType(void) const { + return YGNodeStyleGetPositionType(m_node); } -Value Node::getPosition(int edge) const -{ - return Value::fromYGValue(YGNodeStyleGetPosition(m_node, static_cast(edge))); +Value Node::getPosition(int edge) const { + return Value::fromYGValue( + YGNodeStyleGetPosition(m_node, static_cast(edge))); } -int Node::getAlignContent(void) const -{ - return YGNodeStyleGetAlignContent(m_node); +int Node::getAlignContent(void) const { + return YGNodeStyleGetAlignContent(m_node); } -int Node::getAlignItems(void) const -{ - return YGNodeStyleGetAlignItems(m_node); +int Node::getAlignItems(void) const { + return YGNodeStyleGetAlignItems(m_node); } -int Node::getAlignSelf(void) const -{ - return YGNodeStyleGetAlignSelf(m_node); +int Node::getAlignSelf(void) const { + return YGNodeStyleGetAlignSelf(m_node); } -int Node::getFlexDirection(void) const -{ - return YGNodeStyleGetFlexDirection(m_node); +int Node::getFlexDirection(void) const { + return YGNodeStyleGetFlexDirection(m_node); } -int Node::getFlexWrap(void) const -{ - return YGNodeStyleGetFlexWrap(m_node); +int Node::getFlexWrap(void) const { + return YGNodeStyleGetFlexWrap(m_node); } -int Node::getJustifyContent(void) const -{ - return YGNodeStyleGetJustifyContent(m_node); +int Node::getJustifyContent(void) const { + return YGNodeStyleGetJustifyContent(m_node); } -Value Node::getMargin(int edge) const -{ - return Value::fromYGValue(YGNodeStyleGetMargin(m_node, static_cast(edge))); +Value Node::getMargin(int edge) const { + return Value::fromYGValue( + YGNodeStyleGetMargin(m_node, static_cast(edge))); } -int Node::getOverflow(void) const -{ - return YGNodeStyleGetOverflow(m_node); +int Node::getOverflow(void) const { + return YGNodeStyleGetOverflow(m_node); } -int Node::getDisplay(void) const -{ - return YGNodeStyleGetDisplay(m_node); +int Node::getDisplay(void) const { + return YGNodeStyleGetDisplay(m_node); } -Value Node::getFlexBasis(void) const -{ - return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node)); +Value Node::getFlexBasis(void) const { + return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node)); } -double Node::getFlexGrow(void) const -{ - return YGNodeStyleGetFlexGrow(m_node); +double Node::getFlexGrow(void) const { + return YGNodeStyleGetFlexGrow(m_node); } -double Node::getFlexShrink(void) const -{ - return YGNodeStyleGetFlexShrink(m_node); +double Node::getFlexShrink(void) const { + return YGNodeStyleGetFlexShrink(m_node); } -Value Node::getWidth(void) const -{ - return Value::fromYGValue(YGNodeStyleGetWidth(m_node)); +Value Node::getWidth(void) const { + return Value::fromYGValue(YGNodeStyleGetWidth(m_node)); } -Value Node::getHeight(void) const -{ - return Value::fromYGValue(YGNodeStyleGetHeight(m_node)); +Value Node::getHeight(void) const { + return Value::fromYGValue(YGNodeStyleGetHeight(m_node)); } -Value Node::getMinWidth(void) const -{ - return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node)); +Value Node::getMinWidth(void) const { + return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node)); } -Value Node::getMinHeight(void) const -{ - return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node)); +Value Node::getMinHeight(void) const { + return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node)); } -Value Node::getMaxWidth(void) const -{ - return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node)); +Value Node::getMaxWidth(void) const { + return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node)); } -Value Node::getMaxHeight(void) const -{ - return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node)); +Value Node::getMaxHeight(void) const { + return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node)); } -double Node::getAspectRatio(void) const -{ - return YGNodeStyleGetAspectRatio(m_node); +double Node::getAspectRatio(void) const { + return YGNodeStyleGetAspectRatio(m_node); } -double Node::getBorder(int edge) const -{ - return YGNodeStyleGetBorder(m_node, static_cast(edge)); +double Node::getBorder(int edge) const { + return YGNodeStyleGetBorder(m_node, static_cast(edge)); } -Value Node::getPadding(int edge) const -{ - return Value::fromYGValue(YGNodeStyleGetPadding(m_node, static_cast(edge))); +Value Node::getPadding(int edge) const { + return Value::fromYGValue( + YGNodeStyleGetPadding(m_node, static_cast(edge))); } bool Node::isReferenceBaseline() { return YGNodeIsReferenceBaseline(m_node); } -void Node::insertChild(Node * child, unsigned index) -{ - YGNodeInsertChild(m_node, child->m_node, index); +void Node::insertChild(Node* child, unsigned index) { + YGNodeInsertChild(m_node, child->m_node, index); } -void Node::removeChild(Node * child) -{ - YGNodeRemoveChild(m_node, child->m_node); +void Node::removeChild(Node* child) { + YGNodeRemoveChild(m_node, child->m_node); } -unsigned Node::getChildCount(void) const -{ - return YGNodeGetChildCount(m_node); +unsigned Node::getChildCount(void) const { + return YGNodeGetChildCount(m_node); } -Node * Node::getParent(void) -{ - auto nodePtr = YGNodeGetParent(m_node); +Node* Node::getParent(void) { + auto nodePtr = YGNodeGetParent(m_node); - if (nodePtr == nullptr) - return nullptr; + if (nodePtr == nullptr) + return nullptr; - return Node::fromYGNode(nodePtr); + return Node::fromYGNode(nodePtr); } -Node * Node::getChild(unsigned index) -{ - auto nodePtr = YGNodeGetChild(m_node, index); +Node* Node::getChild(unsigned index) { + auto nodePtr = YGNodeGetChild(m_node, index); - if (nodePtr == nullptr) - return nullptr; + if (nodePtr == nullptr) + return nullptr; - return Node::fromYGNode(nodePtr); + return Node::fromYGNode(nodePtr); } -void Node::setMeasureFunc(nbind::cbFunction & measureFunc) -{ - m_measureFunc.reset(new nbind::cbFunction(measureFunc)); +void Node::setMeasureFunc(nbind::cbFunction& measureFunc) { + m_measureFunc.reset(new nbind::cbFunction(measureFunc)); - YGNodeSetMeasureFunc(m_node, &globalMeasureFunc); + YGNodeSetMeasureFunc(m_node, &globalMeasureFunc); } -void Node::unsetMeasureFunc(void) -{ - m_measureFunc.reset(nullptr); +void Node::unsetMeasureFunc(void) { + m_measureFunc.reset(nullptr); - YGNodeSetMeasureFunc(m_node, nullptr); + YGNodeSetMeasureFunc(m_node, nullptr); } -Size Node::callMeasureFunc(double width, int widthMode, double height, int heightMode) const -{ - return m_measureFunc->call(width, widthMode, height, heightMode); +Size Node::callMeasureFunc( + double width, + int widthMode, + double height, + int heightMode) const { + return m_measureFunc->call(width, widthMode, height, heightMode); } -void Node::setDirtiedFunc(nbind::cbFunction & dirtiedFunc) -{ - m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc)); +void Node::setDirtiedFunc(nbind::cbFunction& dirtiedFunc) { + m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc)); - YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc); + YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc); } void Node::unsetDirtiedFunc(void) { - m_dirtiedFunc.reset(nullptr); + m_dirtiedFunc.reset(nullptr); - YGNodeSetDirtiedFunc(m_node, nullptr); + YGNodeSetDirtiedFunc(m_node, nullptr); } -void Node::callDirtiedFunc(void) const -{ - m_dirtiedFunc->call(); +void Node::callDirtiedFunc(void) const { + m_dirtiedFunc->call(); } -void Node::markDirty(void) -{ - YGNodeMarkDirty(m_node); +void Node::markDirty(void) { + YGNodeMarkDirty(m_node); } -bool Node::isDirty(void) const -{ - return YGNodeIsDirty(m_node); +bool Node::isDirty(void) const { + return YGNodeIsDirty(m_node); } -void Node::calculateLayout(double width, double height, int direction) -{ - YGNodeCalculateLayout(m_node, width, height, static_cast(direction)); +void Node::calculateLayout(double width, double height, int direction) { + YGNodeCalculateLayout( + m_node, width, height, static_cast(direction)); } -double Node::getComputedLeft(void) const -{ - return YGNodeLayoutGetLeft(m_node); +double Node::getComputedLeft(void) const { + return YGNodeLayoutGetLeft(m_node); } -double Node::getComputedRight(void) const -{ - return YGNodeLayoutGetRight(m_node); +double Node::getComputedRight(void) const { + return YGNodeLayoutGetRight(m_node); } -double Node::getComputedTop(void) const -{ - return YGNodeLayoutGetTop(m_node); +double Node::getComputedTop(void) const { + return YGNodeLayoutGetTop(m_node); } -double Node::getComputedBottom(void) const -{ - return YGNodeLayoutGetBottom(m_node); +double Node::getComputedBottom(void) const { + return YGNodeLayoutGetBottom(m_node); } -double Node::getComputedWidth(void) const -{ - return YGNodeLayoutGetWidth(m_node); +double Node::getComputedWidth(void) const { + return YGNodeLayoutGetWidth(m_node); } -double Node::getComputedHeight(void) const -{ - return YGNodeLayoutGetHeight(m_node); +double Node::getComputedHeight(void) const { + return YGNodeLayoutGetHeight(m_node); } -Layout Node::getComputedLayout(void) const -{ - Layout layout; +Layout Node::getComputedLayout(void) const { + Layout layout; - layout.left = YGNodeLayoutGetLeft(m_node); - layout.right = YGNodeLayoutGetRight(m_node); + layout.left = YGNodeLayoutGetLeft(m_node); + layout.right = YGNodeLayoutGetRight(m_node); - layout.top = YGNodeLayoutGetTop(m_node); - layout.bottom = YGNodeLayoutGetBottom(m_node); + layout.top = YGNodeLayoutGetTop(m_node); + layout.bottom = YGNodeLayoutGetBottom(m_node); - layout.width = YGNodeLayoutGetWidth(m_node); - layout.height = YGNodeLayoutGetHeight(m_node); + layout.width = YGNodeLayoutGetWidth(m_node); + layout.height = YGNodeLayoutGetHeight(m_node); - return layout; + return layout; } -double Node::getComputedMargin(int edge) const -{ - return YGNodeLayoutGetMargin(m_node, static_cast(edge)); +double Node::getComputedMargin(int edge) const { + return YGNodeLayoutGetMargin(m_node, static_cast(edge)); } -double Node::getComputedBorder(int edge) const -{ - return YGNodeLayoutGetBorder(m_node, static_cast(edge)); +double Node::getComputedBorder(int edge) const { + return YGNodeLayoutGetBorder(m_node, static_cast(edge)); } -double Node::getComputedPadding(int edge) const -{ - return YGNodeLayoutGetPadding(m_node, static_cast(edge)); +double Node::getComputedPadding(int edge) const { + return YGNodeLayoutGetPadding(m_node, static_cast(edge)); } diff --git a/javascript/sources/Node.hh b/javascript/sources/Node.hh index a311450512..5bd7956b23 100644 --- a/javascript/sources/Node.hh +++ b/javascript/sources/Node.hh @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once #include @@ -20,188 +19,176 @@ class Node { - public: - - static Node * createDefault(void); - static Node * createWithConfig(Config * config); - - static void destroy(Node * node); - - public: - - static Node * fromYGNode(YGNodeRef nodeRef); - - private: - - Node(Config * config); - - public: - - ~Node(void); - - public: // Prevent accidental copy - - Node(Node const &) = delete; - - Node const & operator=(Node const &) = delete; - - public: - - void reset(void); - - public: // Style setters - - void copyStyle(Node const & other); - - void setPositionType(int positionType); - void setPosition(int edge, double position); - void setPositionPercent(int edge, double position); - - void setAlignContent(int alignContent); - void setAlignItems(int alignItems); - void setAlignSelf(int alignSelf); - void setFlexDirection(int flexDirection); - void setFlexWrap(int flexWrap); - void setJustifyContent(int justifyContent); +public: + static Node* createDefault(void); + static Node* createWithConfig(Config* config); - void setMargin(int edge, double margin); - void setMarginPercent(int edge, double margin); - void setMarginAuto(int edge); + static void destroy(Node* node); - void setOverflow(int overflow); - void setDisplay(int display); +public: + static Node* fromYGNode(YGNodeRef nodeRef); - void setFlex(double flex); - void setFlexBasis(double flexBasis); - void setFlexBasisPercent(double flexBasis); - void setFlexBasisAuto(); - void setFlexGrow(double flexGrow); - void setFlexShrink(double flexShrink); +private: + Node(Config* config); - void setWidth(double width); - void setWidthPercent(double width); - void setWidthAuto(); - void setHeight(double height); - void setHeightPercent(double height); - void setHeightAuto(); +public: + ~Node(void); - void setMinWidth(double minWidth); - void setMinWidthPercent(double minWidth); - void setMinHeight(double minHeight); - void setMinHeightPercent(double minHeight); +public: // Prevent accidental copy + Node(Node const&) = delete; - void setMaxWidth(double maxWidth); - void setMaxWidthPercent(double maxWidth); - void setMaxHeight(double maxHeight); - void setMaxHeightPercent(double maxHeight); + Node const& operator=(Node const&) = delete; - void setAspectRatio(double aspectRatio); +public: + void reset(void); - void setBorder(int edge, double border); +public: // Style setters + void copyStyle(Node const& other); - void setPadding(int edge, double padding); - void setPaddingPercent(int edge, double padding); + void setPositionType(int positionType); + void setPosition(int edge, double position); + void setPositionPercent(int edge, double position); - public: // Style getters + void setAlignContent(int alignContent); + void setAlignItems(int alignItems); + void setAlignSelf(int alignSelf); + void setFlexDirection(int flexDirection); + void setFlexWrap(int flexWrap); + void setJustifyContent(int justifyContent); - int getPositionType(void) const; - Value getPosition(int edge) const; + void setMargin(int edge, double margin); + void setMarginPercent(int edge, double margin); + void setMarginAuto(int edge); - int getAlignContent(void) const; - int getAlignItems(void) const; - int getAlignSelf(void) const; - int getFlexDirection(void) const; - int getFlexWrap(void) const; - int getJustifyContent(void) const; + void setOverflow(int overflow); + void setDisplay(int display); - Value getMargin(int edge) const; + void setFlex(double flex); + void setFlexBasis(double flexBasis); + void setFlexBasisPercent(double flexBasis); + void setFlexBasisAuto(); + void setFlexGrow(double flexGrow); + void setFlexShrink(double flexShrink); - int getOverflow(void) const; - int getDisplay(void) const; + void setWidth(double width); + void setWidthPercent(double width); + void setWidthAuto(); + void setHeight(double height); + void setHeightPercent(double height); + void setHeightAuto(); - Value getFlexBasis(void) const; - double getFlexGrow(void) const; - double getFlexShrink(void) const; + void setMinWidth(double minWidth); + void setMinWidthPercent(double minWidth); + void setMinHeight(double minHeight); + void setMinHeightPercent(double minHeight); - Value getWidth(void) const; - Value getHeight(void) const; + void setMaxWidth(double maxWidth); + void setMaxWidthPercent(double maxWidth); + void setMaxHeight(double maxHeight); + void setMaxHeightPercent(double maxHeight); - Value getMinWidth(void) const; - Value getMinHeight(void) const; + void setAspectRatio(double aspectRatio); - Value getMaxWidth(void) const; - Value getMaxHeight(void) const; + void setBorder(int edge, double border); - double getAspectRatio(void) const; + void setPadding(int edge, double padding); + void setPaddingPercent(int edge, double padding); - double getBorder(int edge) const; +public: // Style getters + int getPositionType(void) const; + Value getPosition(int edge) const; - Value getPadding(int edge) const; + int getAlignContent(void) const; + int getAlignItems(void) const; + int getAlignSelf(void) const; + int getFlexDirection(void) const; + int getFlexWrap(void) const; + int getJustifyContent(void) const; - public: // Tree hierarchy mutators + Value getMargin(int edge) const; - void insertChild(Node * child, unsigned index); - void removeChild(Node * child); + int getOverflow(void) const; + int getDisplay(void) const; - public: // Tree hierarchy inspectors + Value getFlexBasis(void) const; + double getFlexGrow(void) const; + double getFlexShrink(void) const; - unsigned getChildCount(void) const; + Value getWidth(void) const; + Value getHeight(void) const; - // The following functions cannot be const because they could discard const qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const) + Value getMinWidth(void) const; + Value getMinHeight(void) const; - Node * getParent(void); - Node * getChild(unsigned index); + Value getMaxWidth(void) const; + Value getMaxHeight(void) const; - public: // Measure func mutators + double getAspectRatio(void) const; - void setMeasureFunc(nbind::cbFunction & measureFunc); - void unsetMeasureFunc(void); + double getBorder(int edge) const; - public: // Measure func inspectors + Value getPadding(int edge) const; - Size callMeasureFunc(double width, int widthMode, double height, int heightMode) const; +public: // Tree hierarchy mutators + void insertChild(Node* child, unsigned index); + void removeChild(Node* child); - public: // Dirtied func mutators +public: // Tree hierarchy inspectors + unsigned getChildCount(void) const; - void setDirtiedFunc(nbind::cbFunction & dirtiedFunc); - void unsetDirtiedFunc(void); + // The following functions cannot be const because they could discard const + // qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const) - public: // Dirtied func inspectors + Node* getParent(void); + Node* getChild(unsigned index); - void callDirtiedFunc(void) const; +public: // Measure func mutators + void setMeasureFunc(nbind::cbFunction& measureFunc); + void unsetMeasureFunc(void); - public: // Dirtiness accessors +public: // Measure func inspectors + Size callMeasureFunc( + double width, + int widthMode, + double height, + int heightMode) const; - void markDirty(void); - bool isDirty(void) const; +public: // Dirtied func mutators + void setDirtiedFunc(nbind::cbFunction& dirtiedFunc); + void unsetDirtiedFunc(void); - public: // Layout mutators +public: // Dirtied func inspectors + void callDirtiedFunc(void) const; - void calculateLayout(double width, double height, int direction); +public: // Dirtiness accessors + void markDirty(void); + bool isDirty(void) const; - public: // Layout inspectors +public: // Layout mutators + void calculateLayout(double width, double height, int direction); - double getComputedLeft(void) const; - double getComputedRight(void) const; +public: // Layout inspectors + double getComputedLeft(void) const; + double getComputedRight(void) const; - double getComputedTop(void) const; - double getComputedBottom(void) const; + double getComputedTop(void) const; + double getComputedBottom(void) const; - double getComputedWidth(void) const; - double getComputedHeight(void) const; + double getComputedWidth(void) const; + double getComputedHeight(void) const; - Layout getComputedLayout(void) const; + Layout getComputedLayout(void) const; - double getComputedMargin(int edge) const; - double getComputedBorder(int edge) const; - double getComputedPadding(int edge) const; + double getComputedMargin(int edge) const; + double getComputedBorder(int edge) const; + double getComputedPadding(int edge) const; - public: - void setIsReferenceBaseline(bool isReferenceBaseline); - bool isReferenceBaseline(); +public: + void setIsReferenceBaseline(bool isReferenceBaseline); + bool isReferenceBaseline(); - YGNodeRef m_node; + YGNodeRef m_node; - std::unique_ptr m_measureFunc; - std::unique_ptr m_dirtiedFunc; + std::unique_ptr m_measureFunc; + std::unique_ptr m_dirtiedFunc; }; diff --git a/javascript/sources/Size.hh b/javascript/sources/Size.hh index b6ac699975..2bcd28ddfc 100644 --- a/javascript/sources/Size.hh +++ b/javascript/sources/Size.hh @@ -1,34 +1,23 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once #include #include -struct Size -{ - double width; - double height; +struct Size { + double width; + double height; - Size(void) - : width(0.0) - , height(0.0) - { - } + Size(void) : width(0.0), height(0.0) {} - Size(double width, double height) - : width(width) - , height(height) - { - } + Size(double width, double height) : width(width), height(height) {} - void toJS(nbind::cbOutput expose) const - { - expose(width, height); - } + void toJS(nbind::cbOutput expose) const { + expose(width, height); + } }; diff --git a/javascript/sources/Value.hh b/javascript/sources/Value.hh index a44cbbbe0d..9191dcf33e 100644 --- a/javascript/sources/Value.hh +++ b/javascript/sources/Value.hh @@ -1,38 +1,26 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once #include -struct Value -{ - static Value fromYGValue(YGValue const & ygValue) - { - return Value(static_cast(ygValue.unit), ygValue.value); - } +struct Value { + static Value fromYGValue(YGValue const& ygValue) { + return Value(static_cast(ygValue.unit), ygValue.value); + } - int unit; - double value; + int unit; + double value; - Value(void) - : unit(YGUnitUndefined) - , value(0.0) - { - } + Value(void) : unit(YGUnitUndefined), value(0.0) {} - Value(int unit, double value) - : unit(unit) - , value(value) - { - } + Value(int unit, double value) : unit(unit), value(value) {} - void toJS(nbind::cbOutput expose) const - { - expose(unit, value); - } + void toJS(nbind::cbOutput expose) const { + expose(unit, value); + } }; diff --git a/javascript/sources/global.cc b/javascript/sources/global.cc index 96096e83e7..ae8454ee01 100644 --- a/javascript/sources/global.cc +++ b/javascript/sources/global.cc @@ -8,7 +8,6 @@ #include "./global.hh" -unsigned getInstanceCount(void) -{ - return YGNodeGetInstanceCount(); +unsigned getInstanceCount(void) { + return YGNodeGetInstanceCount(); } diff --git a/javascript/sources/global.hh b/javascript/sources/global.hh index e424be1afd..15a21f2e8f 100644 --- a/javascript/sources/global.hh +++ b/javascript/sources/global.hh @@ -1,10 +1,9 @@ /** * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. */ - #pragma once unsigned getInstanceCount(void); diff --git a/javascript/sources/nbind.cc b/javascript/sources/nbind.cc index 7f1aac0fae..05f56fa952 100644 --- a/javascript/sources/nbind.cc +++ b/javascript/sources/nbind.cc @@ -15,166 +15,160 @@ #include -NBIND_GLOBAL() -{ - function(getInstanceCount); +NBIND_GLOBAL() { + function(getInstanceCount); } -NBIND_CLASS(Size) -{ - construct<>(); - construct(); +NBIND_CLASS(Size) { + construct<>(); + construct(); } -NBIND_CLASS(Layout) -{ - construct<>(); +NBIND_CLASS(Layout) { + construct<>(); } -NBIND_CLASS(Value) -{ - construct<>(); - construct(); +NBIND_CLASS(Value) { + construct<>(); + construct(); } -NBIND_CLASS(Config) -{ - method(create); +NBIND_CLASS(Config) { + method(create); - method(destroy); + method(destroy); - method(setExperimentalFeatureEnabled); - method(setPointScaleFactor); + method(setExperimentalFeatureEnabled); + method(setPointScaleFactor); - method(isExperimentalFeatureEnabled); + method(isExperimentalFeatureEnabled); } -NBIND_CLASS(Node) -{ - method(createDefault); - method(createWithConfig); - method(destroy); +NBIND_CLASS(Node) { + method(createDefault); + method(createWithConfig); + method(destroy); - method(reset); + method(reset); - method(copyStyle); + method(copyStyle); - method(setPositionType); - method(setPosition); - method(setPositionPercent); + method(setPositionType); + method(setPosition); + method(setPositionPercent); - method(setAlignContent); - method(setAlignItems); - method(setAlignSelf); - method(setFlexDirection); - method(setFlexWrap); - method(setJustifyContent); + method(setAlignContent); + method(setAlignItems); + method(setAlignSelf); + method(setFlexDirection); + method(setFlexWrap); + method(setJustifyContent); - method(setMargin); - method(setMarginPercent); - method(setMarginAuto); + method(setMargin); + method(setMarginPercent); + method(setMarginAuto); - method(setOverflow); - method(setDisplay); + method(setOverflow); + method(setDisplay); - method(setFlex); - method(setFlexBasis); - method(setFlexBasisPercent); - method(setFlexGrow); - method(setFlexShrink); + method(setFlex); + method(setFlexBasis); + method(setFlexBasisPercent); + method(setFlexGrow); + method(setFlexShrink); - method(setWidth); - method(setWidthPercent); - method(setWidthAuto); - method(setHeight); - method(setHeightPercent); - method(setHeightAuto); + method(setWidth); + method(setWidthPercent); + method(setWidthAuto); + method(setHeight); + method(setHeightPercent); + method(setHeightAuto); - method(setMinWidth); - method(setMinWidthPercent); - method(setMinHeight); - method(setMinHeightPercent); + method(setMinWidth); + method(setMinWidthPercent); + method(setMinHeight); + method(setMinHeightPercent); - method(setMaxWidth); - method(setMaxWidthPercent); - method(setMaxHeight); - method(setMaxHeightPercent); + method(setMaxWidth); + method(setMaxWidthPercent); + method(setMaxHeight); + method(setMaxHeightPercent); - method(setAspectRatio); + method(setAspectRatio); - method(setBorder); + method(setBorder); - method(setPadding); - method(setPaddingPercent); + method(setPadding); + method(setPaddingPercent); - method(getPositionType); - method(getPosition); + method(getPositionType); + method(getPosition); - method(getAlignContent); - method(getAlignItems); - method(getAlignSelf); - method(getFlexDirection); - method(getFlexWrap); - method(getJustifyContent); + method(getAlignContent); + method(getAlignItems); + method(getAlignSelf); + method(getFlexDirection); + method(getFlexWrap); + method(getJustifyContent); - method(getMargin); + method(getMargin); - method(getFlexBasis); - method(getFlexGrow); - method(getFlexShrink); + method(getFlexBasis); + method(getFlexGrow); + method(getFlexShrink); - method(getWidth); - method(getHeight); + method(getWidth); + method(getHeight); - method(getMinWidth); - method(getMinHeight); + method(getMinWidth); + method(getMinHeight); - method(getMaxWidth); - method(getMaxHeight); + method(getMaxWidth); + method(getMaxHeight); - method(getAspectRatio); + method(getAspectRatio); - method(getBorder); + method(getBorder); - method(getOverflow); - method(getDisplay); + method(getOverflow); + method(getDisplay); - method(getPadding); + method(getPadding); - method(insertChild); - method(removeChild); + method(insertChild); + method(removeChild); - method(getChildCount); + method(getChildCount); - method(getParent); - method(getChild); + method(getParent); + method(getChild); - method(isReferenceBaseline); - method(setIsReferenceBaseline); + method(isReferenceBaseline); + method(setIsReferenceBaseline); - method(setMeasureFunc); - method(unsetMeasureFunc); + method(setMeasureFunc); + method(unsetMeasureFunc); - method(setDirtiedFunc); - method(unsetDirtiedFunc); + method(setDirtiedFunc); + method(unsetDirtiedFunc); - method(markDirty); - method(isDirty); + method(markDirty); + method(isDirty); - method(calculateLayout); + method(calculateLayout); - method(getComputedLeft); - method(getComputedRight); + method(getComputedLeft); + method(getComputedRight); - method(getComputedTop); - method(getComputedBottom); + method(getComputedTop); + method(getComputedBottom); - method(getComputedWidth); - method(getComputedHeight); + method(getComputedWidth); + method(getComputedHeight); - method(getComputedLayout); + method(getComputedLayout); - method(getComputedMargin); - method(getComputedBorder); - method(getComputedPadding); + method(getComputedMargin); + method(getComputedBorder); + method(getComputedPadding); } diff --git a/tests/CompactValueTest.cpp b/tests/CompactValueTest.cpp index d0a2c669e8..0faf1fca67 100644 --- a/tests/CompactValueTest.cpp +++ b/tests/CompactValueTest.cpp @@ -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) { diff --git a/tests/YGAbsolutePositionTest.cpp b/tests/YGAbsolutePositionTest.cpp index 1faf554f90..6e76b45458 100644 --- a/tests/YGAbsolutePositionTest.cpp +++ b/tests/YGAbsolutePositionTest.cpp @@ -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 #include @@ -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); diff --git a/tests/YGAlignBaselineTest.cpp b/tests/YGAlignBaselineTest.cpp index 5973b85bd1..074223e1d0 100644 --- a/tests/YGAlignBaselineTest.cpp +++ b/tests/YGAlignBaselineTest.cpp @@ -8,8 +8,10 @@ #include #include -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; } diff --git a/tests/YGAlignContentTest.cpp b/tests/YGAlignContentTest.cpp index af6fe529bb..0c6f5322e8 100644 --- a/tests/YGAlignContentTest.cpp +++ b/tests/YGAlignContentTest.cpp @@ -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 #include diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp index 9d99569b5f..217a868903 100644 --- a/tests/YGAspectRatioTest.cpp +++ b/tests/YGAspectRatioTest.cpp @@ -8,11 +8,12 @@ #include #include -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, diff --git a/tests/YGBaselineFuncTest.cpp b/tests/YGBaselineFuncTest.cpp index 1e1027f3a5..af22785f0d 100644 --- a/tests/YGBaselineFuncTest.cpp +++ b/tests/YGBaselineFuncTest.cpp @@ -9,7 +9,7 @@ #include static float _baseline(YGNodeRef node, const float width, const float height) { - float* baseline = (float*)node->getContext(); + float* baseline = (float*) node->getContext(); return *baseline; } diff --git a/tests/YGDefaultValuesTest.cpp b/tests/YGDefaultValuesTest.cpp index 4d4d2c5c26..e8725f7770 100644 --- a/tests/YGDefaultValuesTest.cpp +++ b/tests/YGDefaultValuesTest.cpp @@ -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); diff --git a/tests/YGDirtiedTest.cpp b/tests/YGDirtiedTest.cpp index 5fb291be40..e7792c6229 100644 --- a/tests/YGDirtiedTest.cpp +++ b/tests/YGDirtiedTest.cpp @@ -8,7 +8,7 @@ #include static void _dirtied(YGNodeRef node) { - int* dirtiedCount = (int*)node->getContext(); + int* dirtiedCount = (int*) node->getContext(); (*dirtiedCount)++; } diff --git a/tests/YGFlexDirectionTest.cpp b/tests/YGFlexDirectionTest.cpp index 92bc450d75..7dbcc254f5 100644 --- a/tests/YGFlexDirectionTest.cpp +++ b/tests/YGFlexDirectionTest.cpp @@ -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 #include diff --git a/tests/YGHadOverflowTest.cpp b/tests/YGHadOverflowTest.cpp index d0f8a332d6..f764c8ac86 100644 --- a/tests/YGHadOverflowTest.cpp +++ b/tests/YGHadOverflowTest.cpp @@ -29,7 +29,9 @@ class YogaTest_HadOverflowTests : public Test { 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); diff --git a/tests/YGInfiniteHeightTest.cpp b/tests/YGInfiniteHeightTest.cpp index 6a0cf30738..99d84e0c6d 100644 --- a/tests/YGInfiniteHeightTest.cpp +++ b/tests/YGInfiniteHeightTest.cpp @@ -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(); diff --git a/tests/YGLoggerTest.cpp b/tests/YGLoggerTest.cpp index 3cf1095a94..8ab4f805d3 100644 --- a/tests/YGLoggerTest.cpp +++ b/tests/YGLoggerTest.cpp @@ -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 = "
"; + const char* expected = + "
"; 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 = "
"; + const char* expected = + "
"; 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 = "
\n " - "
\n
\n
"; + const char* expected = + "
\n " + "
\n
\n
"; ASSERT_STREQ(expected, writeBuffer); } diff --git a/tests/YGMeasureCacheTest.cpp b/tests/YGMeasureCacheTest.cpp index dfb7d2e93f..f4c54a53e7 100644 --- a/tests/YGMeasureCacheTest.cpp +++ b/tests/YGMeasureCacheTest.cpp @@ -8,12 +8,13 @@ #include #include -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(); diff --git a/tests/YGMeasureModeTest.cpp b/tests/YGMeasureModeTest.cpp index 9dd0416e87..f0c2062d4e 100644 --- a/tests/YGMeasureModeTest.cpp +++ b/tests/YGMeasureModeTest.cpp @@ -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(); diff --git a/tests/YGMinMaxDimensionTest.cpp b/tests/YGMinMaxDimensionTest.cpp index dd16e5f933..a3bee8247b 100644 --- a/tests/YGMinMaxDimensionTest.cpp +++ b/tests/YGMinMaxDimensionTest.cpp @@ -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 #include diff --git a/tests/YGPercentageTest.cpp b/tests/YGPercentageTest.cpp index 937764136f..e3efb7b6ca 100644 --- a/tests/YGPercentageTest.cpp +++ b/tests/YGPercentageTest.cpp @@ -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); diff --git a/tests/YGRelayoutTest.cpp b/tests/YGRelayoutTest.cpp index fdbe360884..5df3ed5aac 100644 --- a/tests/YGRelayoutTest.cpp +++ b/tests/YGRelayoutTest.cpp @@ -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); diff --git a/tests/YGRoundingFunctionTest.cpp b/tests/YGRoundingFunctionTest.cpp index 672e8afdc2..a02175d908 100644 --- a/tests/YGRoundingFunctionTest.cpp +++ b/tests/YGRoundingFunctionTest.cpp @@ -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)); diff --git a/tests/YGRoundingMeasureFuncTest.cpp b/tests/YGRoundingMeasureFuncTest.cpp index 5cf2120f9a..755e77aaaa 100644 --- a/tests/YGRoundingMeasureFuncTest.cpp +++ b/tests/YGRoundingMeasureFuncTest.cpp @@ -8,33 +8,39 @@ #include #include -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); diff --git a/tests/YGSizeOverflowTest.cpp b/tests/YGSizeOverflowTest.cpp index 73b35b72b0..2d03718896 100644 --- a/tests/YGSizeOverflowTest.cpp +++ b/tests/YGSizeOverflowTest.cpp @@ -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 #include diff --git a/tests/YGTraversalTest.cpp b/tests/YGTraversalTest.cpp index c77ba3f4cf..a3c54cd591 100644 --- a/tests/YGTraversalTest.cpp +++ b/tests/YGTraversalTest.cpp @@ -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 visited; - YGTraversePreOrder(root, [&visited](YGNodeRef node) { - visited.push_back(node); - }); - + YGTraversePreOrder( + root, [&visited](YGNodeRef node) { visited.push_back(node); }); + const std::vector expected = { - root, - root_child0, - root_child0_child0, - root_child1 - }; + root, root_child0, root_child0_child0, root_child1}; ASSERT_EQ(visited, expected); YGNodeFreeRecursive(root); diff --git a/tests/YGTreeMutationTest.cpp b/tests/YGTreeMutationTest.cpp index a7a625cdb2..d35b636e0d 100644 --- a/tests/YGTreeMutationTest.cpp +++ b/tests/YGTreeMutationTest.cpp @@ -7,12 +7,11 @@ #include #include -static std::vector getChildren(YGNodeRef const node) -{ +static std::vector getChildren(YGNodeRef const node) { const uint32_t count = YGNodeGetChildCount(node); std::vector 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 expectedChildren = {root_child0, root_child1}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector owners = {YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1)}; const std::vector expectedOwners = {root, root}; ASSERT_EQ(owners, expectedOwners); @@ -48,7 +48,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) { const std::vector expectedChildren = {}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector owners = {YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1)}; const std::vector expectedOwners = {nullptr, nullptr}; ASSERT_EQ(owners, expectedOwners); @@ -71,7 +72,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) { const std::vector expectedChildren = {root_child2, root_child3}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; + const std::vector owners = {YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1)}; const std::vector 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 children = getChildren(root); - const std::vector expectedChildren = {root_child2, root_child1, root_child3}; + const std::vector expectedChildren = { + root_child2, root_child1, root_child3}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = { - YGNodeGetOwner(root_child0), - YGNodeGetOwner(root_child1), - YGNodeGetOwner(root_child2), - YGNodeGetOwner(root_child3) - }; + const std::vector owners = {YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1), + YGNodeGetOwner(root_child2), + YGNodeGetOwner(root_child3)}; const std::vector expectedOwners = {nullptr, root, root, root}; ASSERT_EQ(owners, expectedOwners); diff --git a/yoga/log.cpp b/yoga/log.cpp index ebb99e45de..62b3d4f058 100644 --- a/yoga/log.cpp +++ b/yoga/log.cpp @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. */ - #include "log.h" #include "Yoga.h"