Automatic lint fixes
Summary: @public A round of automatic lint fixes. Reviewed By: SidharthGuglani Differential Revision: D14590396 fbshipit-source-id: f0b4a0ce503a1d9d46ea7ae788f9f2eac09c2ac7
This commit is contained in:
committed by
Facebook Github Bot
parent
7d7b7b9e18
commit
85352c4e45
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@@ -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;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2014-present, Facebook, Inc.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
* All rights reserved.
|
|
||||||
*
|
*
|
||||||
* This source code is licensed under the license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE-examples file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.samples.yoga;
|
package com.facebook.samples.yoga;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga.android;
|
package com.facebook.yoga.android;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga.android;
|
package com.facebook.yoga.android;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga.android;
|
package com.facebook.yoga.android;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.proguard.annotations;
|
package com.facebook.proguard.annotations;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* 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;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||||
|
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||||
|
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* 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
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@@ -8,37 +8,30 @@
|
|||||||
|
|
||||||
#include "./Config.hh"
|
#include "./Config.hh"
|
||||||
|
|
||||||
/* static */ Config * Config::create(void)
|
/* static */ Config* Config::create(void) {
|
||||||
{
|
return new Config();
|
||||||
return new Config();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void Config::destroy(Config * node)
|
/* static */ void Config::destroy(Config* node) {
|
||||||
{
|
delete node;
|
||||||
delete node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::Config(void)
|
Config::Config(void) : m_config(YGConfigNew()) {}
|
||||||
: m_config(YGConfigNew())
|
|
||||||
{
|
Config::~Config(void) {
|
||||||
|
YGConfigFree(m_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::~Config(void)
|
void Config::setExperimentalFeatureEnabled(int feature, bool enabled) {
|
||||||
{
|
YGConfigSetExperimentalFeatureEnabled(
|
||||||
YGConfigFree(m_config);
|
m_config, static_cast<YGExperimentalFeature>(feature), enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setExperimentalFeatureEnabled(int feature, bool enabled)
|
void Config::setPointScaleFactor(float pixelsInPoint) {
|
||||||
{
|
YGConfigSetPointScaleFactor(m_config, pixelsInPoint);
|
||||||
YGConfigSetExperimentalFeatureEnabled(m_config, static_cast<YGExperimentalFeature>(feature), enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setPointScaleFactor(float pixelsInPoint)
|
bool Config::isExperimentalFeatureEnabled(int feature) const {
|
||||||
{
|
return YGConfigIsExperimentalFeatureEnabled(
|
||||||
YGConfigSetPointScaleFactor(m_config, pixelsInPoint);
|
m_config, static_cast<YGExperimentalFeature>(feature));
|
||||||
}
|
|
||||||
|
|
||||||
bool Config::isExperimentalFeatureEnabled(int feature) const
|
|
||||||
{
|
|
||||||
return YGConfigIsExperimentalFeatureEnabled(m_config, static_cast<YGExperimentalFeature>(feature));
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nbind/api.h>
|
#include <nbind/api.h>
|
||||||
@@ -13,39 +12,31 @@
|
|||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
|
|
||||||
friend class Node;
|
friend class Node;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static Config* create(void);
|
||||||
|
|
||||||
static Config * create(void);
|
static void destroy(Config* config);
|
||||||
|
|
||||||
static void destroy(Config * config);
|
private:
|
||||||
|
Config(void);
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
~Config(void);
|
||||||
|
|
||||||
Config(void);
|
public: // Prevent accidental copy
|
||||||
|
Config(Config const&) = delete;
|
||||||
|
|
||||||
public:
|
Config const& operator=(Config const&) = delete;
|
||||||
|
|
||||||
~Config(void);
|
public: // Setters
|
||||||
|
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
||||||
|
void setPointScaleFactor(float pixelsInPoint);
|
||||||
|
|
||||||
public: // Prevent accidental copy
|
public: // Getters
|
||||||
|
bool isExperimentalFeatureEnabled(int feature) const;
|
||||||
Config(Config const &) = delete;
|
|
||||||
|
|
||||||
Config const & operator=(Config const &) = delete;
|
|
||||||
|
|
||||||
public: // Setters
|
|
||||||
|
|
||||||
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
|
||||||
void setPointScaleFactor(float pixelsInPoint);
|
|
||||||
|
|
||||||
public: // Getters
|
|
||||||
|
|
||||||
bool isExperimentalFeatureEnabled(int feature) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
YGConfigRef m_config;
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
YGConfigRef m_config;
|
||||||
};
|
};
|
||||||
|
@@ -1,28 +1,25 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nbind/api.h>
|
#include <nbind/api.h>
|
||||||
#include <nbind/BindDefiner.h>
|
#include <nbind/BindDefiner.h>
|
||||||
|
|
||||||
struct Layout
|
struct Layout {
|
||||||
{
|
double left;
|
||||||
double left;
|
double right;
|
||||||
double right;
|
|
||||||
|
|
||||||
double top;
|
double top;
|
||||||
double bottom;
|
double bottom;
|
||||||
|
|
||||||
double width;
|
double width;
|
||||||
double height;
|
double height;
|
||||||
|
|
||||||
void toJS(nbind::cbOutput expose) const
|
void toJS(nbind::cbOutput expose) const {
|
||||||
{
|
expose(left, right, top, bottom, width, height);
|
||||||
expose(left, right, top, bottom, width, height);
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@@ -13,521 +13,445 @@
|
|||||||
#include "./Size.hh"
|
#include "./Size.hh"
|
||||||
#include "./Config.hh"
|
#include "./Config.hh"
|
||||||
|
|
||||||
static YGSize globalMeasureFunc(YGNodeRef nodeRef, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
|
static YGSize globalMeasureFunc(
|
||||||
{
|
YGNodeRef nodeRef,
|
||||||
Node const & node = *reinterpret_cast<Node const *>(YGNodeGetContext(nodeRef));
|
float width,
|
||||||
|
YGMeasureMode widthMode,
|
||||||
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
|
Node const& node = *reinterpret_cast<Node const*>(YGNodeGetContext(nodeRef));
|
||||||
|
|
||||||
Size size = node.callMeasureFunc(width, widthMode, height, heightMode);
|
Size size = node.callMeasureFunc(width, widthMode, height, heightMode);
|
||||||
YGSize ygSize = { static_cast<float>(size.width), static_cast<float>(size.height) };
|
YGSize ygSize = {static_cast<float>(size.width),
|
||||||
|
static_cast<float>(size.height)};
|
||||||
|
|
||||||
return ygSize;
|
return ygSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void globalDirtiedFunc(YGNodeRef nodeRef)
|
static void globalDirtiedFunc(YGNodeRef nodeRef) {
|
||||||
{
|
Node const& node = *reinterpret_cast<Node const*>(YGNodeGetContext(nodeRef));
|
||||||
Node const & node = *reinterpret_cast<Node const *>(YGNodeGetContext(nodeRef));
|
|
||||||
|
|
||||||
node.callDirtiedFunc();
|
node.callDirtiedFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ Node * Node::createDefault(void)
|
/* static */ Node* Node::createDefault(void) {
|
||||||
{
|
return new Node(nullptr);
|
||||||
return new Node(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ Node * Node::createWithConfig(Config * config)
|
/* static */ Node* Node::createWithConfig(Config* config) {
|
||||||
{
|
return new Node(config);
|
||||||
return new Node(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void Node::destroy(Node * node)
|
/* static */ void Node::destroy(Node* node) {
|
||||||
{
|
delete node;
|
||||||
delete node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ Node * Node::fromYGNode(YGNodeRef nodeRef)
|
/* static */ Node* Node::fromYGNode(YGNodeRef nodeRef) {
|
||||||
{
|
return reinterpret_cast<Node*>(YGNodeGetContext(nodeRef));
|
||||||
return reinterpret_cast<Node *>(YGNodeGetContext(nodeRef));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::Node(Config * config)
|
Node::Node(Config* config)
|
||||||
: m_node(config != nullptr ? YGNodeNewWithConfig(config->m_config) : YGNodeNew())
|
: m_node(
|
||||||
, m_measureFunc(nullptr)
|
config != nullptr ? YGNodeNewWithConfig(config->m_config)
|
||||||
, m_dirtiedFunc(nullptr)
|
: YGNodeNew()),
|
||||||
{
|
m_measureFunc(nullptr),
|
||||||
YGNodeSetContext(m_node, reinterpret_cast<void *>(this));
|
m_dirtiedFunc(nullptr) {
|
||||||
|
YGNodeSetContext(m_node, reinterpret_cast<void*>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::~Node(void)
|
Node::~Node(void) {
|
||||||
{
|
YGNodeFree(m_node);
|
||||||
YGNodeFree(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::reset(void)
|
void Node::reset(void) {
|
||||||
{
|
m_measureFunc.reset(nullptr);
|
||||||
m_measureFunc.reset(nullptr);
|
m_dirtiedFunc.reset(nullptr);
|
||||||
m_dirtiedFunc.reset(nullptr);
|
|
||||||
|
|
||||||
YGNodeReset(m_node);
|
YGNodeReset(m_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::copyStyle(Node const & other)
|
void Node::copyStyle(Node const& other) {
|
||||||
{
|
YGNodeCopyStyle(m_node, other.m_node);
|
||||||
YGNodeCopyStyle(m_node, other.m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setPositionType(int positionType)
|
void Node::setPositionType(int positionType) {
|
||||||
{
|
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
||||||
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setPosition(int edge, double position)
|
void Node::setPosition(int edge, double position) {
|
||||||
{
|
YGNodeStyleSetPosition(m_node, static_cast<YGEdge>(edge), position);
|
||||||
YGNodeStyleSetPosition(m_node, static_cast<YGEdge>(edge), position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setPositionPercent(int edge, double position)
|
void Node::setPositionPercent(int edge, double position) {
|
||||||
{
|
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setAlignContent(int alignContent)
|
void Node::setAlignContent(int alignContent) {
|
||||||
{
|
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setAlignItems(int alignItems)
|
void Node::setAlignItems(int alignItems) {
|
||||||
{
|
YGNodeStyleSetAlignItems(m_node, static_cast<YGAlign>(alignItems));
|
||||||
YGNodeStyleSetAlignItems(m_node, static_cast<YGAlign>(alignItems));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setAlignSelf(int alignSelf)
|
void Node::setAlignSelf(int alignSelf) {
|
||||||
{
|
YGNodeStyleSetAlignSelf(m_node, static_cast<YGAlign>(alignSelf));
|
||||||
YGNodeStyleSetAlignSelf(m_node, static_cast<YGAlign>(alignSelf));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexDirection(int flexDirection)
|
void Node::setFlexDirection(int flexDirection) {
|
||||||
{
|
YGNodeStyleSetFlexDirection(
|
||||||
YGNodeStyleSetFlexDirection(m_node, static_cast<YGFlexDirection>(flexDirection));
|
m_node, static_cast<YGFlexDirection>(flexDirection));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexWrap(int flexWrap)
|
void Node::setFlexWrap(int flexWrap) {
|
||||||
{
|
YGNodeStyleSetFlexWrap(m_node, static_cast<YGWrap>(flexWrap));
|
||||||
YGNodeStyleSetFlexWrap(m_node, static_cast<YGWrap>(flexWrap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setJustifyContent(int justifyContent)
|
void Node::setJustifyContent(int justifyContent) {
|
||||||
{
|
YGNodeStyleSetJustifyContent(m_node, static_cast<YGJustify>(justifyContent));
|
||||||
YGNodeStyleSetJustifyContent(m_node, static_cast<YGJustify>(justifyContent));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMargin(int edge, double margin)
|
void Node::setMargin(int edge, double margin) {
|
||||||
{
|
YGNodeStyleSetMargin(m_node, static_cast<YGEdge>(edge), margin);
|
||||||
YGNodeStyleSetMargin(m_node, static_cast<YGEdge>(edge), margin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMarginPercent(int edge, double margin)
|
void Node::setMarginPercent(int edge, double margin) {
|
||||||
{
|
YGNodeStyleSetMarginPercent(m_node, static_cast<YGEdge>(edge), margin);
|
||||||
YGNodeStyleSetMarginPercent(m_node, static_cast<YGEdge>(edge), margin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMarginAuto(int edge)
|
void Node::setMarginAuto(int edge) {
|
||||||
{
|
YGNodeStyleSetMarginAuto(m_node, static_cast<YGEdge>(edge));
|
||||||
YGNodeStyleSetMarginAuto(m_node, static_cast<YGEdge>(edge));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setOverflow(int overflow)
|
void Node::setOverflow(int overflow) {
|
||||||
{
|
YGNodeStyleSetOverflow(m_node, static_cast<YGOverflow>(overflow));
|
||||||
YGNodeStyleSetOverflow(m_node, static_cast<YGOverflow>(overflow));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setDisplay(int display)
|
void Node::setDisplay(int display) {
|
||||||
{
|
YGNodeStyleSetDisplay(m_node, static_cast<YGDisplay>(display));
|
||||||
YGNodeStyleSetDisplay(m_node, static_cast<YGDisplay>(display));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlex(double flex)
|
void Node::setFlex(double flex) {
|
||||||
{
|
YGNodeStyleSetFlex(m_node, flex);
|
||||||
YGNodeStyleSetFlex(m_node, flex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexBasis(double flexBasis)
|
void Node::setFlexBasis(double flexBasis) {
|
||||||
{
|
YGNodeStyleSetFlexBasis(m_node, flexBasis);
|
||||||
YGNodeStyleSetFlexBasis(m_node, flexBasis);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexBasisPercent(double flexBasis)
|
void Node::setFlexBasisPercent(double flexBasis) {
|
||||||
{
|
YGNodeStyleSetFlexBasisPercent(m_node, flexBasis);
|
||||||
YGNodeStyleSetFlexBasisPercent(m_node, flexBasis);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexGrow(double flexGrow)
|
void Node::setFlexGrow(double flexGrow) {
|
||||||
{
|
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setFlexShrink(double flexShrink)
|
void Node::setFlexShrink(double flexShrink) {
|
||||||
{
|
YGNodeStyleSetFlexShrink(m_node, flexShrink);
|
||||||
YGNodeStyleSetFlexShrink(m_node, flexShrink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setWidth(double width)
|
void Node::setWidth(double width) {
|
||||||
{
|
YGNodeStyleSetWidth(m_node, width);
|
||||||
YGNodeStyleSetWidth(m_node, width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setWidthPercent(double width)
|
void Node::setWidthPercent(double width) {
|
||||||
{
|
YGNodeStyleSetWidthPercent(m_node, width);
|
||||||
YGNodeStyleSetWidthPercent(m_node, width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setWidthAuto()
|
void Node::setWidthAuto() {
|
||||||
{
|
YGNodeStyleSetWidthAuto(m_node);
|
||||||
YGNodeStyleSetWidthAuto(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setHeight(double height)
|
void Node::setHeight(double height) {
|
||||||
{
|
YGNodeStyleSetHeight(m_node, height);
|
||||||
YGNodeStyleSetHeight(m_node, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setHeightPercent(double height)
|
void Node::setHeightPercent(double height) {
|
||||||
{
|
YGNodeStyleSetHeightPercent(m_node, height);
|
||||||
YGNodeStyleSetHeightPercent(m_node, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setHeightAuto()
|
void Node::setHeightAuto() {
|
||||||
{
|
YGNodeStyleSetHeightAuto(m_node);
|
||||||
YGNodeStyleSetHeightAuto(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMinWidth(double minWidth)
|
void Node::setMinWidth(double minWidth) {
|
||||||
{
|
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMinWidthPercent(double minWidth)
|
void Node::setMinWidthPercent(double minWidth) {
|
||||||
{
|
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMinHeight(double minHeight)
|
void Node::setMinHeight(double minHeight) {
|
||||||
{
|
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMinHeightPercent(double minHeight)
|
void Node::setMinHeightPercent(double minHeight) {
|
||||||
{
|
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMaxWidth(double maxWidth)
|
void Node::setMaxWidth(double maxWidth) {
|
||||||
{
|
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMaxWidthPercent(double maxWidth)
|
void Node::setMaxWidthPercent(double maxWidth) {
|
||||||
{
|
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMaxHeight(double maxHeight)
|
void Node::setMaxHeight(double maxHeight) {
|
||||||
{
|
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMaxHeightPercent(double maxHeight)
|
void Node::setMaxHeightPercent(double maxHeight) {
|
||||||
{
|
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setAspectRatio(double aspectRatio)
|
void Node::setAspectRatio(double aspectRatio) {
|
||||||
{
|
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setBorder(int edge, double border)
|
void Node::setBorder(int edge, double border) {
|
||||||
{
|
YGNodeStyleSetBorder(m_node, static_cast<YGEdge>(edge), border);
|
||||||
YGNodeStyleSetBorder(m_node, static_cast<YGEdge>(edge), border);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setPadding(int edge, double padding)
|
void Node::setPadding(int edge, double padding) {
|
||||||
{
|
YGNodeStyleSetPadding(m_node, static_cast<YGEdge>(edge), padding);
|
||||||
YGNodeStyleSetPadding(m_node, static_cast<YGEdge>(edge), padding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setPaddingPercent(int edge, double padding)
|
void Node::setPaddingPercent(int edge, double padding) {
|
||||||
{
|
YGNodeStyleSetPaddingPercent(m_node, static_cast<YGEdge>(edge), padding);
|
||||||
YGNodeStyleSetPaddingPercent(m_node, static_cast<YGEdge>(edge), padding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setIsReferenceBaseline(bool isReferenceBaseline) {
|
void Node::setIsReferenceBaseline(bool isReferenceBaseline) {
|
||||||
YGNodeSetIsReferenceBaseline(m_node, isReferenceBaseline);
|
YGNodeSetIsReferenceBaseline(m_node, isReferenceBaseline);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getPositionType(void) const
|
int Node::getPositionType(void) const {
|
||||||
{
|
return YGNodeStyleGetPositionType(m_node);
|
||||||
return YGNodeStyleGetPositionType(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getPosition(int edge) const
|
Value Node::getPosition(int edge) const {
|
||||||
{
|
return Value::fromYGValue(
|
||||||
return Value::fromYGValue(YGNodeStyleGetPosition(m_node, static_cast<YGEdge>(edge)));
|
YGNodeStyleGetPosition(m_node, static_cast<YGEdge>(edge)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getAlignContent(void) const
|
int Node::getAlignContent(void) const {
|
||||||
{
|
return YGNodeStyleGetAlignContent(m_node);
|
||||||
return YGNodeStyleGetAlignContent(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getAlignItems(void) const
|
int Node::getAlignItems(void) const {
|
||||||
{
|
return YGNodeStyleGetAlignItems(m_node);
|
||||||
return YGNodeStyleGetAlignItems(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getAlignSelf(void) const
|
int Node::getAlignSelf(void) const {
|
||||||
{
|
return YGNodeStyleGetAlignSelf(m_node);
|
||||||
return YGNodeStyleGetAlignSelf(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getFlexDirection(void) const
|
int Node::getFlexDirection(void) const {
|
||||||
{
|
return YGNodeStyleGetFlexDirection(m_node);
|
||||||
return YGNodeStyleGetFlexDirection(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getFlexWrap(void) const
|
int Node::getFlexWrap(void) const {
|
||||||
{
|
return YGNodeStyleGetFlexWrap(m_node);
|
||||||
return YGNodeStyleGetFlexWrap(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getJustifyContent(void) const
|
int Node::getJustifyContent(void) const {
|
||||||
{
|
return YGNodeStyleGetJustifyContent(m_node);
|
||||||
return YGNodeStyleGetJustifyContent(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getMargin(int edge) const
|
Value Node::getMargin(int edge) const {
|
||||||
{
|
return Value::fromYGValue(
|
||||||
return Value::fromYGValue(YGNodeStyleGetMargin(m_node, static_cast<YGEdge>(edge)));
|
YGNodeStyleGetMargin(m_node, static_cast<YGEdge>(edge)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getOverflow(void) const
|
int Node::getOverflow(void) const {
|
||||||
{
|
return YGNodeStyleGetOverflow(m_node);
|
||||||
return YGNodeStyleGetOverflow(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Node::getDisplay(void) const
|
int Node::getDisplay(void) const {
|
||||||
{
|
return YGNodeStyleGetDisplay(m_node);
|
||||||
return YGNodeStyleGetDisplay(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getFlexBasis(void) const
|
Value Node::getFlexBasis(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetFlexBasis(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getFlexGrow(void) const
|
double Node::getFlexGrow(void) const {
|
||||||
{
|
return YGNodeStyleGetFlexGrow(m_node);
|
||||||
return YGNodeStyleGetFlexGrow(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getFlexShrink(void) const
|
double Node::getFlexShrink(void) const {
|
||||||
{
|
return YGNodeStyleGetFlexShrink(m_node);
|
||||||
return YGNodeStyleGetFlexShrink(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getWidth(void) const
|
Value Node::getWidth(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetWidth(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetWidth(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getHeight(void) const
|
Value Node::getHeight(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetHeight(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetHeight(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getMinWidth(void) const
|
Value Node::getMinWidth(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetMinWidth(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getMinHeight(void) const
|
Value Node::getMinHeight(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetMinHeight(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getMaxWidth(void) const
|
Value Node::getMaxWidth(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetMaxWidth(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getMaxHeight(void) const
|
Value Node::getMaxHeight(void) const {
|
||||||
{
|
return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node));
|
||||||
return Value::fromYGValue(YGNodeStyleGetMaxHeight(m_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getAspectRatio(void) const
|
double Node::getAspectRatio(void) const {
|
||||||
{
|
return YGNodeStyleGetAspectRatio(m_node);
|
||||||
return YGNodeStyleGetAspectRatio(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getBorder(int edge) const
|
double Node::getBorder(int edge) const {
|
||||||
{
|
return YGNodeStyleGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||||
return YGNodeStyleGetBorder(m_node, static_cast<YGEdge>(edge));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Node::getPadding(int edge) const
|
Value Node::getPadding(int edge) const {
|
||||||
{
|
return Value::fromYGValue(
|
||||||
return Value::fromYGValue(YGNodeStyleGetPadding(m_node, static_cast<YGEdge>(edge)));
|
YGNodeStyleGetPadding(m_node, static_cast<YGEdge>(edge)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Node::isReferenceBaseline() {
|
bool Node::isReferenceBaseline() {
|
||||||
return YGNodeIsReferenceBaseline(m_node);
|
return YGNodeIsReferenceBaseline(m_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::insertChild(Node * child, unsigned index)
|
void Node::insertChild(Node* child, unsigned index) {
|
||||||
{
|
YGNodeInsertChild(m_node, child->m_node, index);
|
||||||
YGNodeInsertChild(m_node, child->m_node, index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::removeChild(Node * child)
|
void Node::removeChild(Node* child) {
|
||||||
{
|
YGNodeRemoveChild(m_node, child->m_node);
|
||||||
YGNodeRemoveChild(m_node, child->m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Node::getChildCount(void) const
|
unsigned Node::getChildCount(void) const {
|
||||||
{
|
return YGNodeGetChildCount(m_node);
|
||||||
return YGNodeGetChildCount(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node * Node::getParent(void)
|
Node* Node::getParent(void) {
|
||||||
{
|
auto nodePtr = YGNodeGetParent(m_node);
|
||||||
auto nodePtr = YGNodeGetParent(m_node);
|
|
||||||
|
|
||||||
if (nodePtr == nullptr)
|
if (nodePtr == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return Node::fromYGNode(nodePtr);
|
return Node::fromYGNode(nodePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node * Node::getChild(unsigned index)
|
Node* Node::getChild(unsigned index) {
|
||||||
{
|
auto nodePtr = YGNodeGetChild(m_node, index);
|
||||||
auto nodePtr = YGNodeGetChild(m_node, index);
|
|
||||||
|
|
||||||
if (nodePtr == nullptr)
|
if (nodePtr == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return Node::fromYGNode(nodePtr);
|
return Node::fromYGNode(nodePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setMeasureFunc(nbind::cbFunction & measureFunc)
|
void Node::setMeasureFunc(nbind::cbFunction& measureFunc) {
|
||||||
{
|
m_measureFunc.reset(new nbind::cbFunction(measureFunc));
|
||||||
m_measureFunc.reset(new nbind::cbFunction(measureFunc));
|
|
||||||
|
|
||||||
YGNodeSetMeasureFunc(m_node, &globalMeasureFunc);
|
YGNodeSetMeasureFunc(m_node, &globalMeasureFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::unsetMeasureFunc(void)
|
void Node::unsetMeasureFunc(void) {
|
||||||
{
|
m_measureFunc.reset(nullptr);
|
||||||
m_measureFunc.reset(nullptr);
|
|
||||||
|
|
||||||
YGNodeSetMeasureFunc(m_node, nullptr);
|
YGNodeSetMeasureFunc(m_node, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size Node::callMeasureFunc(double width, int widthMode, double height, int heightMode) const
|
Size Node::callMeasureFunc(
|
||||||
{
|
double width,
|
||||||
return m_measureFunc->call<Size>(width, widthMode, height, heightMode);
|
int widthMode,
|
||||||
|
double height,
|
||||||
|
int heightMode) const {
|
||||||
|
return m_measureFunc->call<Size>(width, widthMode, height, heightMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setDirtiedFunc(nbind::cbFunction & dirtiedFunc)
|
void Node::setDirtiedFunc(nbind::cbFunction& dirtiedFunc) {
|
||||||
{
|
m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc));
|
||||||
m_dirtiedFunc.reset(new nbind::cbFunction(dirtiedFunc));
|
|
||||||
|
|
||||||
YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc);
|
YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::unsetDirtiedFunc(void) {
|
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
|
void Node::callDirtiedFunc(void) const {
|
||||||
{
|
m_dirtiedFunc->call<void>();
|
||||||
m_dirtiedFunc->call<void>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::markDirty(void)
|
void Node::markDirty(void) {
|
||||||
{
|
YGNodeMarkDirty(m_node);
|
||||||
YGNodeMarkDirty(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Node::isDirty(void) const
|
bool Node::isDirty(void) const {
|
||||||
{
|
return YGNodeIsDirty(m_node);
|
||||||
return YGNodeIsDirty(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::calculateLayout(double width, double height, int direction)
|
void Node::calculateLayout(double width, double height, int direction) {
|
||||||
{
|
YGNodeCalculateLayout(
|
||||||
YGNodeCalculateLayout(m_node, width, height, static_cast<YGDirection>(direction));
|
m_node, width, height, static_cast<YGDirection>(direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedLeft(void) const
|
double Node::getComputedLeft(void) const {
|
||||||
{
|
return YGNodeLayoutGetLeft(m_node);
|
||||||
return YGNodeLayoutGetLeft(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedRight(void) const
|
double Node::getComputedRight(void) const {
|
||||||
{
|
return YGNodeLayoutGetRight(m_node);
|
||||||
return YGNodeLayoutGetRight(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedTop(void) const
|
double Node::getComputedTop(void) const {
|
||||||
{
|
return YGNodeLayoutGetTop(m_node);
|
||||||
return YGNodeLayoutGetTop(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedBottom(void) const
|
double Node::getComputedBottom(void) const {
|
||||||
{
|
return YGNodeLayoutGetBottom(m_node);
|
||||||
return YGNodeLayoutGetBottom(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedWidth(void) const
|
double Node::getComputedWidth(void) const {
|
||||||
{
|
return YGNodeLayoutGetWidth(m_node);
|
||||||
return YGNodeLayoutGetWidth(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedHeight(void) const
|
double Node::getComputedHeight(void) const {
|
||||||
{
|
return YGNodeLayoutGetHeight(m_node);
|
||||||
return YGNodeLayoutGetHeight(m_node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout Node::getComputedLayout(void) const
|
Layout Node::getComputedLayout(void) const {
|
||||||
{
|
Layout layout;
|
||||||
Layout layout;
|
|
||||||
|
|
||||||
layout.left = YGNodeLayoutGetLeft(m_node);
|
layout.left = YGNodeLayoutGetLeft(m_node);
|
||||||
layout.right = YGNodeLayoutGetRight(m_node);
|
layout.right = YGNodeLayoutGetRight(m_node);
|
||||||
|
|
||||||
layout.top = YGNodeLayoutGetTop(m_node);
|
layout.top = YGNodeLayoutGetTop(m_node);
|
||||||
layout.bottom = YGNodeLayoutGetBottom(m_node);
|
layout.bottom = YGNodeLayoutGetBottom(m_node);
|
||||||
|
|
||||||
layout.width = YGNodeLayoutGetWidth(m_node);
|
layout.width = YGNodeLayoutGetWidth(m_node);
|
||||||
layout.height = YGNodeLayoutGetHeight(m_node);
|
layout.height = YGNodeLayoutGetHeight(m_node);
|
||||||
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedMargin(int edge) const
|
double Node::getComputedMargin(int edge) const {
|
||||||
{
|
return YGNodeLayoutGetMargin(m_node, static_cast<YGEdge>(edge));
|
||||||
return YGNodeLayoutGetMargin(m_node, static_cast<YGEdge>(edge));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedBorder(int edge) const
|
double Node::getComputedBorder(int edge) const {
|
||||||
{
|
return YGNodeLayoutGetBorder(m_node, static_cast<YGEdge>(edge));
|
||||||
return YGNodeLayoutGetBorder(m_node, static_cast<YGEdge>(edge));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::getComputedPadding(int edge) const
|
double Node::getComputedPadding(int edge) const {
|
||||||
{
|
return YGNodeLayoutGetPadding(m_node, static_cast<YGEdge>(edge));
|
||||||
return YGNodeLayoutGetPadding(m_node, static_cast<YGEdge>(edge));
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -20,188 +19,176 @@
|
|||||||
|
|
||||||
class Node {
|
class Node {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static Node* createDefault(void);
|
||||||
|
static Node* createWithConfig(Config* config);
|
||||||
|
|
||||||
static Node * createDefault(void);
|
static void destroy(Node* node);
|
||||||
static Node * createWithConfig(Config * config);
|
|
||||||
|
|
||||||
static void destroy(Node * node);
|
public:
|
||||||
|
static Node* fromYGNode(YGNodeRef nodeRef);
|
||||||
|
|
||||||
public:
|
private:
|
||||||
|
Node(Config* config);
|
||||||
|
|
||||||
static Node * fromYGNode(YGNodeRef nodeRef);
|
public:
|
||||||
|
~Node(void);
|
||||||
|
|
||||||
private:
|
public: // Prevent accidental copy
|
||||||
|
Node(Node const&) = delete;
|
||||||
|
|
||||||
Node(Config * config);
|
Node const& operator=(Node const&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void reset(void);
|
||||||
|
|
||||||
~Node(void);
|
public: // Style setters
|
||||||
|
void copyStyle(Node const& other);
|
||||||
|
|
||||||
public: // Prevent accidental copy
|
void setPositionType(int positionType);
|
||||||
|
void setPosition(int edge, double position);
|
||||||
|
void setPositionPercent(int edge, double position);
|
||||||
|
|
||||||
Node(Node const &) = delete;
|
void setAlignContent(int alignContent);
|
||||||
|
void setAlignItems(int alignItems);
|
||||||
|
void setAlignSelf(int alignSelf);
|
||||||
|
void setFlexDirection(int flexDirection);
|
||||||
|
void setFlexWrap(int flexWrap);
|
||||||
|
void setJustifyContent(int justifyContent);
|
||||||
|
|
||||||
Node const & operator=(Node const &) = delete;
|
void setMargin(int edge, double margin);
|
||||||
|
void setMarginPercent(int edge, double margin);
|
||||||
|
void setMarginAuto(int edge);
|
||||||
|
|
||||||
public:
|
void setOverflow(int overflow);
|
||||||
|
void setDisplay(int display);
|
||||||
|
|
||||||
void reset(void);
|
void setFlex(double flex);
|
||||||
|
void setFlexBasis(double flexBasis);
|
||||||
|
void setFlexBasisPercent(double flexBasis);
|
||||||
|
void setFlexBasisAuto();
|
||||||
|
void setFlexGrow(double flexGrow);
|
||||||
|
void setFlexShrink(double flexShrink);
|
||||||
|
|
||||||
public: // Style setters
|
void setWidth(double width);
|
||||||
|
void setWidthPercent(double width);
|
||||||
|
void setWidthAuto();
|
||||||
|
void setHeight(double height);
|
||||||
|
void setHeightPercent(double height);
|
||||||
|
void setHeightAuto();
|
||||||
|
|
||||||
void copyStyle(Node const & other);
|
void setMinWidth(double minWidth);
|
||||||
|
void setMinWidthPercent(double minWidth);
|
||||||
|
void setMinHeight(double minHeight);
|
||||||
|
void setMinHeightPercent(double minHeight);
|
||||||
|
|
||||||
void setPositionType(int positionType);
|
void setMaxWidth(double maxWidth);
|
||||||
void setPosition(int edge, double position);
|
void setMaxWidthPercent(double maxWidth);
|
||||||
void setPositionPercent(int edge, double position);
|
void setMaxHeight(double maxHeight);
|
||||||
|
void setMaxHeightPercent(double maxHeight);
|
||||||
|
|
||||||
void setAlignContent(int alignContent);
|
void setAspectRatio(double aspectRatio);
|
||||||
void setAlignItems(int alignItems);
|
|
||||||
void setAlignSelf(int alignSelf);
|
|
||||||
void setFlexDirection(int flexDirection);
|
|
||||||
void setFlexWrap(int flexWrap);
|
|
||||||
void setJustifyContent(int justifyContent);
|
|
||||||
|
|
||||||
void setMargin(int edge, double margin);
|
void setBorder(int edge, double border);
|
||||||
void setMarginPercent(int edge, double margin);
|
|
||||||
void setMarginAuto(int edge);
|
|
||||||
|
|
||||||
void setOverflow(int overflow);
|
void setPadding(int edge, double padding);
|
||||||
void setDisplay(int display);
|
void setPaddingPercent(int edge, double padding);
|
||||||
|
|
||||||
void setFlex(double flex);
|
public: // Style getters
|
||||||
void setFlexBasis(double flexBasis);
|
int getPositionType(void) const;
|
||||||
void setFlexBasisPercent(double flexBasis);
|
Value getPosition(int edge) const;
|
||||||
void setFlexBasisAuto();
|
|
||||||
void setFlexGrow(double flexGrow);
|
|
||||||
void setFlexShrink(double flexShrink);
|
|
||||||
|
|
||||||
void setWidth(double width);
|
int getAlignContent(void) const;
|
||||||
void setWidthPercent(double width);
|
int getAlignItems(void) const;
|
||||||
void setWidthAuto();
|
int getAlignSelf(void) const;
|
||||||
void setHeight(double height);
|
int getFlexDirection(void) const;
|
||||||
void setHeightPercent(double height);
|
int getFlexWrap(void) const;
|
||||||
void setHeightAuto();
|
int getJustifyContent(void) const;
|
||||||
|
|
||||||
void setMinWidth(double minWidth);
|
Value getMargin(int edge) const;
|
||||||
void setMinWidthPercent(double minWidth);
|
|
||||||
void setMinHeight(double minHeight);
|
|
||||||
void setMinHeightPercent(double minHeight);
|
|
||||||
|
|
||||||
void setMaxWidth(double maxWidth);
|
int getOverflow(void) const;
|
||||||
void setMaxWidthPercent(double maxWidth);
|
int getDisplay(void) const;
|
||||||
void setMaxHeight(double maxHeight);
|
|
||||||
void setMaxHeightPercent(double maxHeight);
|
|
||||||
|
|
||||||
void setAspectRatio(double aspectRatio);
|
Value getFlexBasis(void) const;
|
||||||
|
double getFlexGrow(void) const;
|
||||||
|
double getFlexShrink(void) const;
|
||||||
|
|
||||||
void setBorder(int edge, double border);
|
Value getWidth(void) const;
|
||||||
|
Value getHeight(void) const;
|
||||||
|
|
||||||
void setPadding(int edge, double padding);
|
Value getMinWidth(void) const;
|
||||||
void setPaddingPercent(int edge, double padding);
|
Value getMinHeight(void) const;
|
||||||
|
|
||||||
public: // Style getters
|
Value getMaxWidth(void) const;
|
||||||
|
Value getMaxHeight(void) const;
|
||||||
|
|
||||||
int getPositionType(void) const;
|
double getAspectRatio(void) const;
|
||||||
Value getPosition(int edge) const;
|
|
||||||
|
|
||||||
int getAlignContent(void) const;
|
double getBorder(int edge) const;
|
||||||
int getAlignItems(void) const;
|
|
||||||
int getAlignSelf(void) const;
|
|
||||||
int getFlexDirection(void) const;
|
|
||||||
int getFlexWrap(void) const;
|
|
||||||
int getJustifyContent(void) const;
|
|
||||||
|
|
||||||
Value getMargin(int edge) const;
|
Value getPadding(int edge) const;
|
||||||
|
|
||||||
int getOverflow(void) const;
|
public: // Tree hierarchy mutators
|
||||||
int getDisplay(void) const;
|
void insertChild(Node* child, unsigned index);
|
||||||
|
void removeChild(Node* child);
|
||||||
|
|
||||||
Value getFlexBasis(void) const;
|
public: // Tree hierarchy inspectors
|
||||||
double getFlexGrow(void) const;
|
unsigned getChildCount(void) const;
|
||||||
double getFlexShrink(void) const;
|
|
||||||
|
|
||||||
Value getWidth(void) const;
|
// The following functions cannot be const because they could discard const
|
||||||
Value getHeight(void) const;
|
// qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const)
|
||||||
|
|
||||||
Value getMinWidth(void) const;
|
Node* getParent(void);
|
||||||
Value getMinHeight(void) const;
|
Node* getChild(unsigned index);
|
||||||
|
|
||||||
Value getMaxWidth(void) const;
|
public: // Measure func mutators
|
||||||
Value getMaxHeight(void) const;
|
void setMeasureFunc(nbind::cbFunction& measureFunc);
|
||||||
|
void unsetMeasureFunc(void);
|
||||||
|
|
||||||
double getAspectRatio(void) const;
|
public: // Measure func inspectors
|
||||||
|
Size callMeasureFunc(
|
||||||
|
double width,
|
||||||
|
int widthMode,
|
||||||
|
double height,
|
||||||
|
int heightMode) const;
|
||||||
|
|
||||||
double getBorder(int edge) const;
|
public: // Dirtied func mutators
|
||||||
|
void setDirtiedFunc(nbind::cbFunction& dirtiedFunc);
|
||||||
|
void unsetDirtiedFunc(void);
|
||||||
|
|
||||||
Value getPadding(int edge) const;
|
public: // Dirtied func inspectors
|
||||||
|
void callDirtiedFunc(void) const;
|
||||||
|
|
||||||
public: // Tree hierarchy mutators
|
public: // Dirtiness accessors
|
||||||
|
void markDirty(void);
|
||||||
|
bool isDirty(void) const;
|
||||||
|
|
||||||
void insertChild(Node * child, unsigned index);
|
public: // Layout mutators
|
||||||
void removeChild(Node * child);
|
void calculateLayout(double width, double height, int direction);
|
||||||
|
|
||||||
public: // Tree hierarchy inspectors
|
public: // Layout inspectors
|
||||||
|
double getComputedLeft(void) const;
|
||||||
|
double getComputedRight(void) const;
|
||||||
|
|
||||||
unsigned getChildCount(void) const;
|
double getComputedTop(void) const;
|
||||||
|
double getComputedBottom(void) const;
|
||||||
|
|
||||||
// The following functions cannot be const because they could discard const qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const)
|
double getComputedWidth(void) const;
|
||||||
|
double getComputedHeight(void) const;
|
||||||
|
|
||||||
Node * getParent(void);
|
Layout getComputedLayout(void) const;
|
||||||
Node * getChild(unsigned index);
|
|
||||||
|
|
||||||
public: // Measure func mutators
|
double getComputedMargin(int edge) const;
|
||||||
|
double getComputedBorder(int edge) const;
|
||||||
|
double getComputedPadding(int edge) const;
|
||||||
|
|
||||||
void setMeasureFunc(nbind::cbFunction & measureFunc);
|
public:
|
||||||
void unsetMeasureFunc(void);
|
void setIsReferenceBaseline(bool isReferenceBaseline);
|
||||||
|
bool isReferenceBaseline();
|
||||||
|
|
||||||
public: // Measure func inspectors
|
YGNodeRef m_node;
|
||||||
|
|
||||||
Size callMeasureFunc(double width, int widthMode, double height, int heightMode) const;
|
std::unique_ptr<nbind::cbFunction> m_measureFunc;
|
||||||
|
std::unique_ptr<nbind::cbFunction> m_dirtiedFunc;
|
||||||
public: // Dirtied func mutators
|
|
||||||
|
|
||||||
void setDirtiedFunc(nbind::cbFunction & dirtiedFunc);
|
|
||||||
void unsetDirtiedFunc(void);
|
|
||||||
|
|
||||||
public: // Dirtied func inspectors
|
|
||||||
|
|
||||||
void callDirtiedFunc(void) const;
|
|
||||||
|
|
||||||
public: // Dirtiness accessors
|
|
||||||
|
|
||||||
void markDirty(void);
|
|
||||||
bool isDirty(void) const;
|
|
||||||
|
|
||||||
public: // Layout mutators
|
|
||||||
|
|
||||||
void calculateLayout(double width, double height, int direction);
|
|
||||||
|
|
||||||
public: // Layout inspectors
|
|
||||||
|
|
||||||
double getComputedLeft(void) const;
|
|
||||||
double getComputedRight(void) const;
|
|
||||||
|
|
||||||
double getComputedTop(void) const;
|
|
||||||
double getComputedBottom(void) const;
|
|
||||||
|
|
||||||
double getComputedWidth(void) const;
|
|
||||||
double getComputedHeight(void) const;
|
|
||||||
|
|
||||||
Layout getComputedLayout(void) const;
|
|
||||||
|
|
||||||
double getComputedMargin(int edge) const;
|
|
||||||
double getComputedBorder(int edge) const;
|
|
||||||
double getComputedPadding(int edge) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void setIsReferenceBaseline(bool isReferenceBaseline);
|
|
||||||
bool isReferenceBaseline();
|
|
||||||
|
|
||||||
YGNodeRef m_node;
|
|
||||||
|
|
||||||
std::unique_ptr<nbind::cbFunction> m_measureFunc;
|
|
||||||
std::unique_ptr<nbind::cbFunction> m_dirtiedFunc;
|
|
||||||
};
|
};
|
||||||
|
@@ -1,34 +1,23 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nbind/api.h>
|
#include <nbind/api.h>
|
||||||
#include <nbind/BindDefiner.h>
|
#include <nbind/BindDefiner.h>
|
||||||
|
|
||||||
struct Size
|
struct Size {
|
||||||
{
|
double width;
|
||||||
double width;
|
double height;
|
||||||
double height;
|
|
||||||
|
|
||||||
Size(void)
|
Size(void) : width(0.0), height(0.0) {}
|
||||||
: width(0.0)
|
|
||||||
, height(0.0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Size(double width, double height)
|
Size(double width, double height) : width(width), height(height) {}
|
||||||
: width(width)
|
|
||||||
, height(height)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void toJS(nbind::cbOutput expose) const
|
void toJS(nbind::cbOutput expose) const {
|
||||||
{
|
expose(width, height);
|
||||||
expose(width, height);
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@@ -1,38 +1,26 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
struct Value
|
struct Value {
|
||||||
{
|
static Value fromYGValue(YGValue const& ygValue) {
|
||||||
static Value fromYGValue(YGValue const & ygValue)
|
return Value(static_cast<int>(ygValue.unit), ygValue.value);
|
||||||
{
|
}
|
||||||
return Value(static_cast<int>(ygValue.unit), ygValue.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
int unit;
|
int unit;
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
Value(void)
|
Value(void) : unit(YGUnitUndefined), value(0.0) {}
|
||||||
: unit(YGUnitUndefined)
|
|
||||||
, value(0.0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Value(int unit, double value)
|
Value(int unit, double value) : unit(unit), value(value) {}
|
||||||
: unit(unit)
|
|
||||||
, value(value)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void toJS(nbind::cbOutput expose) const
|
void toJS(nbind::cbOutput expose) const {
|
||||||
{
|
expose(unit, value);
|
||||||
expose(unit, value);
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "./global.hh"
|
#include "./global.hh"
|
||||||
|
|
||||||
unsigned getInstanceCount(void)
|
unsigned getInstanceCount(void) {
|
||||||
{
|
return YGNodeGetInstanceCount();
|
||||||
return YGNodeGetInstanceCount();
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* LICENSE file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
unsigned getInstanceCount(void);
|
unsigned getInstanceCount(void);
|
||||||
|
@@ -15,166 +15,160 @@
|
|||||||
|
|
||||||
#include <nbind/nbind.h>
|
#include <nbind/nbind.h>
|
||||||
|
|
||||||
NBIND_GLOBAL()
|
NBIND_GLOBAL() {
|
||||||
{
|
function(getInstanceCount);
|
||||||
function(getInstanceCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NBIND_CLASS(Size)
|
NBIND_CLASS(Size) {
|
||||||
{
|
construct<>();
|
||||||
construct<>();
|
construct<double, double>();
|
||||||
construct<double, double>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NBIND_CLASS(Layout)
|
NBIND_CLASS(Layout) {
|
||||||
{
|
construct<>();
|
||||||
construct<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NBIND_CLASS(Value)
|
NBIND_CLASS(Value) {
|
||||||
{
|
construct<>();
|
||||||
construct<>();
|
construct<int, double>();
|
||||||
construct<int, double>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NBIND_CLASS(Config)
|
NBIND_CLASS(Config) {
|
||||||
{
|
method(create);
|
||||||
method(create);
|
|
||||||
|
|
||||||
method(destroy);
|
method(destroy);
|
||||||
|
|
||||||
method(setExperimentalFeatureEnabled);
|
method(setExperimentalFeatureEnabled);
|
||||||
method(setPointScaleFactor);
|
method(setPointScaleFactor);
|
||||||
|
|
||||||
method(isExperimentalFeatureEnabled);
|
method(isExperimentalFeatureEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBIND_CLASS(Node)
|
NBIND_CLASS(Node) {
|
||||||
{
|
method(createDefault);
|
||||||
method(createDefault);
|
method(createWithConfig);
|
||||||
method(createWithConfig);
|
method(destroy);
|
||||||
method(destroy);
|
|
||||||
|
|
||||||
method(reset);
|
method(reset);
|
||||||
|
|
||||||
method(copyStyle);
|
method(copyStyle);
|
||||||
|
|
||||||
method(setPositionType);
|
method(setPositionType);
|
||||||
method(setPosition);
|
method(setPosition);
|
||||||
method(setPositionPercent);
|
method(setPositionPercent);
|
||||||
|
|
||||||
method(setAlignContent);
|
method(setAlignContent);
|
||||||
method(setAlignItems);
|
method(setAlignItems);
|
||||||
method(setAlignSelf);
|
method(setAlignSelf);
|
||||||
method(setFlexDirection);
|
method(setFlexDirection);
|
||||||
method(setFlexWrap);
|
method(setFlexWrap);
|
||||||
method(setJustifyContent);
|
method(setJustifyContent);
|
||||||
|
|
||||||
method(setMargin);
|
method(setMargin);
|
||||||
method(setMarginPercent);
|
method(setMarginPercent);
|
||||||
method(setMarginAuto);
|
method(setMarginAuto);
|
||||||
|
|
||||||
method(setOverflow);
|
method(setOverflow);
|
||||||
method(setDisplay);
|
method(setDisplay);
|
||||||
|
|
||||||
method(setFlex);
|
method(setFlex);
|
||||||
method(setFlexBasis);
|
method(setFlexBasis);
|
||||||
method(setFlexBasisPercent);
|
method(setFlexBasisPercent);
|
||||||
method(setFlexGrow);
|
method(setFlexGrow);
|
||||||
method(setFlexShrink);
|
method(setFlexShrink);
|
||||||
|
|
||||||
method(setWidth);
|
method(setWidth);
|
||||||
method(setWidthPercent);
|
method(setWidthPercent);
|
||||||
method(setWidthAuto);
|
method(setWidthAuto);
|
||||||
method(setHeight);
|
method(setHeight);
|
||||||
method(setHeightPercent);
|
method(setHeightPercent);
|
||||||
method(setHeightAuto);
|
method(setHeightAuto);
|
||||||
|
|
||||||
method(setMinWidth);
|
method(setMinWidth);
|
||||||
method(setMinWidthPercent);
|
method(setMinWidthPercent);
|
||||||
method(setMinHeight);
|
method(setMinHeight);
|
||||||
method(setMinHeightPercent);
|
method(setMinHeightPercent);
|
||||||
|
|
||||||
method(setMaxWidth);
|
method(setMaxWidth);
|
||||||
method(setMaxWidthPercent);
|
method(setMaxWidthPercent);
|
||||||
method(setMaxHeight);
|
method(setMaxHeight);
|
||||||
method(setMaxHeightPercent);
|
method(setMaxHeightPercent);
|
||||||
|
|
||||||
method(setAspectRatio);
|
method(setAspectRatio);
|
||||||
|
|
||||||
method(setBorder);
|
method(setBorder);
|
||||||
|
|
||||||
method(setPadding);
|
method(setPadding);
|
||||||
method(setPaddingPercent);
|
method(setPaddingPercent);
|
||||||
|
|
||||||
method(getPositionType);
|
method(getPositionType);
|
||||||
method(getPosition);
|
method(getPosition);
|
||||||
|
|
||||||
method(getAlignContent);
|
method(getAlignContent);
|
||||||
method(getAlignItems);
|
method(getAlignItems);
|
||||||
method(getAlignSelf);
|
method(getAlignSelf);
|
||||||
method(getFlexDirection);
|
method(getFlexDirection);
|
||||||
method(getFlexWrap);
|
method(getFlexWrap);
|
||||||
method(getJustifyContent);
|
method(getJustifyContent);
|
||||||
|
|
||||||
method(getMargin);
|
method(getMargin);
|
||||||
|
|
||||||
method(getFlexBasis);
|
method(getFlexBasis);
|
||||||
method(getFlexGrow);
|
method(getFlexGrow);
|
||||||
method(getFlexShrink);
|
method(getFlexShrink);
|
||||||
|
|
||||||
method(getWidth);
|
method(getWidth);
|
||||||
method(getHeight);
|
method(getHeight);
|
||||||
|
|
||||||
method(getMinWidth);
|
method(getMinWidth);
|
||||||
method(getMinHeight);
|
method(getMinHeight);
|
||||||
|
|
||||||
method(getMaxWidth);
|
method(getMaxWidth);
|
||||||
method(getMaxHeight);
|
method(getMaxHeight);
|
||||||
|
|
||||||
method(getAspectRatio);
|
method(getAspectRatio);
|
||||||
|
|
||||||
method(getBorder);
|
method(getBorder);
|
||||||
|
|
||||||
method(getOverflow);
|
method(getOverflow);
|
||||||
method(getDisplay);
|
method(getDisplay);
|
||||||
|
|
||||||
method(getPadding);
|
method(getPadding);
|
||||||
|
|
||||||
method(insertChild);
|
method(insertChild);
|
||||||
method(removeChild);
|
method(removeChild);
|
||||||
|
|
||||||
method(getChildCount);
|
method(getChildCount);
|
||||||
|
|
||||||
method(getParent);
|
method(getParent);
|
||||||
method(getChild);
|
method(getChild);
|
||||||
|
|
||||||
method(isReferenceBaseline);
|
method(isReferenceBaseline);
|
||||||
method(setIsReferenceBaseline);
|
method(setIsReferenceBaseline);
|
||||||
|
|
||||||
method(setMeasureFunc);
|
method(setMeasureFunc);
|
||||||
method(unsetMeasureFunc);
|
method(unsetMeasureFunc);
|
||||||
|
|
||||||
method(setDirtiedFunc);
|
method(setDirtiedFunc);
|
||||||
method(unsetDirtiedFunc);
|
method(unsetDirtiedFunc);
|
||||||
|
|
||||||
method(markDirty);
|
method(markDirty);
|
||||||
method(isDirty);
|
method(isDirty);
|
||||||
|
|
||||||
method(calculateLayout);
|
method(calculateLayout);
|
||||||
|
|
||||||
method(getComputedLeft);
|
method(getComputedLeft);
|
||||||
method(getComputedRight);
|
method(getComputedRight);
|
||||||
|
|
||||||
method(getComputedTop);
|
method(getComputedTop);
|
||||||
method(getComputedBottom);
|
method(getComputedBottom);
|
||||||
|
|
||||||
method(getComputedWidth);
|
method(getComputedWidth);
|
||||||
method(getComputedHeight);
|
method(getComputedHeight);
|
||||||
|
|
||||||
method(getComputedLayout);
|
method(getComputedLayout);
|
||||||
|
|
||||||
method(getComputedMargin);
|
method(getComputedMargin);
|
||||||
method(getComputedBorder);
|
method(getComputedBorder);
|
||||||
method(getComputedPadding);
|
method(getComputedPadding);
|
||||||
}
|
}
|
||||||
|
@@ -325,10 +325,10 @@ TEST(YogaTest, can_be_assigned_from_YGValue) {
|
|||||||
|
|
||||||
YGValue v{2.0f, YGUnitPercent};
|
YGValue v{2.0f, YGUnitPercent};
|
||||||
c = v;
|
c = v;
|
||||||
ASSERT_EQ((YGValue)c, v);
|
ASSERT_EQ((YGValue) c, v);
|
||||||
|
|
||||||
c = YGValue{123, YGUnitPoint};
|
c = YGValue{123, YGUnitPoint};
|
||||||
ASSERT_EQ((YGValue)c, (YGValue{123, YGUnitPoint}));
|
ASSERT_EQ((YGValue) c, (YGValue{123, YGUnitPoint}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, compact_value_bound_representations) {
|
TEST(YogaTest, compact_value_bound_representations) {
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGAbsolutePositionTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
@@ -183,7 +184,9 @@ TEST(YogaTest, absolute_layout_width_height_start_top_end_bottom) {
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -575,7 +578,9 @@ TEST(YogaTest, absolute_layout_align_items_center_on_child_only) {
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -620,7 +625,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_top_po
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -665,7 +672,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_bottom
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -710,7 +719,9 @@ TEST(YogaTest, absolute_layout_align_items_and_justify_content_center_and_left_p
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
@@ -8,8 +8,10 @@
|
|||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static float
|
static float _baselineFunc(
|
||||||
_baselineFunc(YGNodeRef node, const float width, const float height) {
|
YGNodeRef node,
|
||||||
|
const float width,
|
||||||
|
const float height) {
|
||||||
return height / 2;
|
return height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGAlignContentTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
@@ -8,11 +8,12 @@
|
|||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static YGSize _measure(YGNodeRef node,
|
static YGSize _measure(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
return YGSize{
|
return YGSize{
|
||||||
.width = widthMode == YGMeasureModeExactly ? width : 50,
|
.width = widthMode == YGMeasureModeExactly ? width : 50,
|
||||||
.height = heightMode == YGMeasureModeExactly ? height : 50,
|
.height = heightMode == YGMeasureModeExactly ? height : 50,
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static float _baseline(YGNodeRef node, const float width, const float height) {
|
static float _baseline(YGNodeRef node, const float width, const float height) {
|
||||||
float* baseline = (float*)node->getContext();
|
float* baseline = (float*) node->getContext();
|
||||||
return *baseline;
|
return *baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,7 +89,7 @@ TEST(YogaTest, assert_default_values) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, assert_webdefault_values) {
|
TEST(YogaTest, assert_webdefault_values) {
|
||||||
YGConfig *config = YGConfigNew();
|
YGConfig* config = YGConfigNew();
|
||||||
YGConfigSetUseWebDefaults(config, true);
|
YGConfigSetUseWebDefaults(config, true);
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ TEST(YogaTest, assert_webdefault_values) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, assert_webdefault_values_reset) {
|
TEST(YogaTest, assert_webdefault_values_reset) {
|
||||||
YGConfig *config = YGConfigNew();
|
YGConfig* config = YGConfigNew();
|
||||||
YGConfigSetUseWebDefaults(config, true);
|
YGConfigSetUseWebDefaults(config, true);
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeReset(root);
|
YGNodeReset(root);
|
||||||
@@ -116,7 +116,7 @@ TEST(YogaTest, assert_webdefault_values_reset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, assert_legacy_stretch_behaviour) {
|
TEST(YogaTest, assert_legacy_stretch_behaviour) {
|
||||||
YGConfig *config = YGConfigNew();
|
YGConfig* config = YGConfigNew();
|
||||||
YGConfigSetUseLegacyStretchBehaviour(config, true);
|
YGConfigSetUseLegacyStretchBehaviour(config, true);
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root, 500);
|
YGNodeStyleSetWidth(root, 500);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
|
|
||||||
static void _dirtied(YGNodeRef node) {
|
static void _dirtied(YGNodeRef node) {
|
||||||
int* dirtiedCount = (int*)node->getContext();
|
int* dirtiedCount = (int*) node->getContext();
|
||||||
(*dirtiedCount)++;
|
(*dirtiedCount)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGFlexDirectionTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
@@ -29,7 +29,9 @@ protected:
|
|||||||
YGConfigRef config;
|
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);
|
const YGNodeRef child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(child0, 80);
|
YGNodeStyleSetWidth(child0, 80);
|
||||||
YGNodeStyleSetHeight(child0, 40);
|
YGNodeStyleSetHeight(child0, 40);
|
||||||
@@ -47,7 +49,9 @@ TEST_F(YogaTest_HadOverflowTests, children_overflow_no_wrap_and_no_flex_children
|
|||||||
ASSERT_TRUE(YGNodeLayoutGetHadOverflow(root));
|
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);
|
const YGNodeRef child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(child0, 80);
|
YGNodeStyleSetWidth(child0, 80);
|
||||||
YGNodeStyleSetHeight(child0, 40);
|
YGNodeStyleSetHeight(child0, 40);
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
// This test isn't correct from the Flexbox standard standpoint,
|
// This test isn't correct from the Flexbox standard standpoint,
|
||||||
// because percentages are calculated with parent constraints.
|
// 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) {
|
TEST(YogaTest, percent_absolute_position_infinite_height) {
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
@@ -10,17 +10,19 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
char writeBuffer[4096];
|
char writeBuffer[4096];
|
||||||
int _unmanagedLogger(const YGConfigRef config,
|
int _unmanagedLogger(
|
||||||
const YGNodeRef node,
|
const YGConfigRef config,
|
||||||
YGLogLevel level,
|
const YGNodeRef node,
|
||||||
const char *format,
|
YGLogLevel level,
|
||||||
va_list args) {
|
const char* format,
|
||||||
return vsnprintf(writeBuffer + strlen(writeBuffer),
|
va_list args) {
|
||||||
sizeof(writeBuffer) - strlen(writeBuffer),
|
return vsnprintf(
|
||||||
format,
|
writeBuffer + strlen(writeBuffer),
|
||||||
args);
|
sizeof(writeBuffer) - strlen(writeBuffer),
|
||||||
}
|
format,
|
||||||
|
args);
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
TEST(YogaTest, config_print_tree_enabled) {
|
TEST(YogaTest, config_print_tree_enabled) {
|
||||||
writeBuffer[0] = '\0';
|
writeBuffer[0] = '\0';
|
||||||
@@ -68,13 +70,16 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
|||||||
YGConfigSetLogger(config, _unmanagedLogger);
|
YGConfigSetLogger(config, _unmanagedLogger);
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(root,
|
YGNodePrint(
|
||||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
root,
|
||||||
YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFree(root);
|
YGNodeFree(root);
|
||||||
|
|
||||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" ></div>";
|
const char* expected =
|
||||||
|
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
||||||
|
"></div>";
|
||||||
ASSERT_STREQ(expected, writeBuffer);
|
ASSERT_STREQ(expected, writeBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,15 +95,17 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
|||||||
YGNodeStyleSetMargin(root, YGEdgeRight, 10);
|
YGNodeStyleSetMargin(root, YGEdgeRight, 10);
|
||||||
YGNodeStyleSetMarginAuto(root, YGEdgeLeft);
|
YGNodeStyleSetMarginAuto(root, YGEdgeLeft);
|
||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(root,
|
YGNodePrint(
|
||||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
root,
|
||||||
YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFree(root);
|
YGNodeFree(root);
|
||||||
|
|
||||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
|
const char* expected =
|
||||||
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
|
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"flex: 1; "
|
||||||
"position: absolute; \" ></div>";
|
"margin-left: auto; margin-right: 10px; width: 50%; height: 75%; "
|
||||||
|
"position: absolute; \" ></div>";
|
||||||
ASSERT_STREQ(expected, writeBuffer);
|
ASSERT_STREQ(expected, writeBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,15 +119,17 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
|||||||
YGNodeInsertChild(root, child0, 0);
|
YGNodeInsertChild(root, child0, 0);
|
||||||
YGNodeInsertChild(root, child1, 1);
|
YGNodeInsertChild(root, child1, 1);
|
||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(root,
|
YGNodePrint(
|
||||||
(YGPrintOptions)(YGPrintOptionsLayout | YGPrintOptionsChildren |
|
root,
|
||||||
YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
const char *expected = "<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
|
const char* expected =
|
||||||
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" >\n "
|
||||||
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
|
"<div layout=\"width: 0; height: 0; top: 0; left: 0;\" style=\"\" "
|
||||||
"style=\"\" ></div>\n</div>";
|
"></div>\n <div layout=\"width: 0; height: 0; top: 0; left: 0;\" "
|
||||||
|
"style=\"\" ></div>\n</div>";
|
||||||
ASSERT_STREQ(expected, writeBuffer);
|
ASSERT_STREQ(expected, writeBuffer);
|
||||||
}
|
}
|
||||||
|
@@ -8,12 +8,13 @@
|
|||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static YGSize _measureMax(YGNodeRef node,
|
static YGSize _measureMax(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
int* measureCount = (int*)node->getContext();
|
YGMeasureMode heightMode) {
|
||||||
|
int* measureCount = (int*) node->getContext();
|
||||||
(*measureCount)++;
|
(*measureCount)++;
|
||||||
|
|
||||||
return YGSize{
|
return YGSize{
|
||||||
@@ -22,37 +23,40 @@ static YGSize _measureMax(YGNodeRef node,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGSize _measureMin(YGNodeRef node,
|
static YGSize _measureMin(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
int* measureCount = (int*)node->getContext();
|
YGMeasureMode heightMode) {
|
||||||
|
int* measureCount = (int*) node->getContext();
|
||||||
*measureCount = *measureCount + 1;
|
*measureCount = *measureCount + 1;
|
||||||
return YGSize{
|
return YGSize{
|
||||||
.width =
|
.width = widthMode == YGMeasureModeUndefined ||
|
||||||
widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10)
|
(widthMode == YGMeasureModeAtMost && width > 10)
|
||||||
? 10
|
? 10
|
||||||
: width,
|
: width,
|
||||||
.height =
|
.height = heightMode == YGMeasureModeUndefined ||
|
||||||
heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10)
|
(heightMode == YGMeasureModeAtMost && height > 10)
|
||||||
? 10
|
? 10
|
||||||
: height,
|
: height,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGSize _measure_84_49(YGNodeRef node,
|
static YGSize _measure_84_49(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
int* measureCount = (int*)node->getContext();
|
YGMeasureMode heightMode) {
|
||||||
|
int* measureCount = (int*) node->getContext();
|
||||||
if (measureCount) {
|
if (measureCount) {
|
||||||
(*measureCount)++;
|
(*measureCount)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YGSize{
|
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);
|
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;
|
int measureCount = 0;
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
|
@@ -17,17 +17,18 @@ struct _MeasureConstraint {
|
|||||||
|
|
||||||
struct _MeasureConstraintList {
|
struct _MeasureConstraintList {
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
struct _MeasureConstraint *constraints;
|
struct _MeasureConstraint* constraints;
|
||||||
};
|
};
|
||||||
|
|
||||||
static YGSize _measure(YGNodeRef node,
|
static YGSize _measure(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
struct _MeasureConstraintList* constraintList =
|
struct _MeasureConstraintList* constraintList =
|
||||||
(struct _MeasureConstraintList*)node->getContext();
|
(struct _MeasureConstraintList*) node->getContext();
|
||||||
struct _MeasureConstraint *constraints = constraintList->constraints;
|
struct _MeasureConstraint* constraints = constraintList->constraints;
|
||||||
uint32_t currentIndex = constraintList->length;
|
uint32_t currentIndex = constraintList->length;
|
||||||
(&constraints[currentIndex])->width = width;
|
(&constraints[currentIndex])->width = width;
|
||||||
(&constraints[currentIndex])->widthMode = widthMode;
|
(&constraints[currentIndex])->widthMode = widthMode;
|
||||||
@@ -44,7 +45,8 @@ static YGSize _measure(YGNodeRef node,
|
|||||||
TEST(YogaTest, exactly_measure_stretched_child_column) {
|
TEST(YogaTest, exactly_measure_stretched_child_column) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -72,7 +74,8 @@ TEST(YogaTest, exactly_measure_stretched_child_column) {
|
|||||||
TEST(YogaTest, exactly_measure_stretched_child_row) {
|
TEST(YogaTest, exactly_measure_stretched_child_row) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -100,7 +103,8 @@ TEST(YogaTest, exactly_measure_stretched_child_row) {
|
|||||||
TEST(YogaTest, at_most_main_axis_column) {
|
TEST(YogaTest, at_most_main_axis_column) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -126,7 +130,8 @@ TEST(YogaTest, at_most_main_axis_column) {
|
|||||||
TEST(YogaTest, at_most_cross_axis_column) {
|
TEST(YogaTest, at_most_cross_axis_column) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -153,7 +158,8 @@ TEST(YogaTest, at_most_cross_axis_column) {
|
|||||||
TEST(YogaTest, at_most_main_axis_row) {
|
TEST(YogaTest, at_most_main_axis_row) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -180,7 +186,8 @@ TEST(YogaTest, at_most_main_axis_row) {
|
|||||||
TEST(YogaTest, at_most_cross_axis_row) {
|
TEST(YogaTest, at_most_cross_axis_row) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -208,7 +215,8 @@ TEST(YogaTest, at_most_cross_axis_row) {
|
|||||||
TEST(YogaTest, flex_child) {
|
TEST(YogaTest, flex_child) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -237,7 +245,8 @@ TEST(YogaTest, flex_child) {
|
|||||||
TEST(YogaTest, flex_child_with_flex_basis) {
|
TEST(YogaTest, flex_child_with_flex_basis) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -264,7 +273,8 @@ TEST(YogaTest, flex_child_with_flex_basis) {
|
|||||||
TEST(YogaTest, overflow_scroll_column) {
|
TEST(YogaTest, overflow_scroll_column) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
@@ -295,7 +305,8 @@ TEST(YogaTest, overflow_scroll_column) {
|
|||||||
TEST(YogaTest, overflow_scroll_row) {
|
TEST(YogaTest, overflow_scroll_row) {
|
||||||
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
struct _MeasureConstraintList constraintList = _MeasureConstraintList{
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.constraints = (struct _MeasureConstraint *) malloc(10 * sizeof(struct _MeasureConstraint)),
|
.constraints = (struct _MeasureConstraint*) malloc(
|
||||||
|
10 * sizeof(struct _MeasureConstraint)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNew();
|
const YGNodeRef root = YGNodeNew();
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGMinMaxDimensionTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
@@ -647,7 +647,9 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
|||||||
YGConfigFree(config);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
|
TEST(YogaTest, dont_cache_computed_flex_basis_between_layouts) {
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureWebFlexBasis, true);
|
YGConfigSetExperimentalFeatureEnabled(
|
||||||
|
config, YGExperimentalFeatureWebFlexBasis, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetHeightPercent(root, 100);
|
YGNodeStyleSetHeightPercent(root, 100);
|
||||||
|
@@ -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, true, false));
|
||||||
ASSERT_FLOAT_EQ(-6.0, YGRoundValueToPixelGrid(-5.999999, 2.0, false, true));
|
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.0, YGRoundValueToPixelGrid(6.01, 2.0, false, false));
|
||||||
ASSERT_FLOAT_EQ(6.5, YGRoundValueToPixelGrid(6.01, 2.0, true, 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));
|
ASSERT_FLOAT_EQ(6.0, YGRoundValueToPixelGrid(6.01, 2.0, false, true));
|
||||||
|
@@ -8,33 +8,39 @@
|
|||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static YGSize _measureFloor(YGNodeRef node,
|
static YGSize _measureFloor(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
return YGSize{
|
return YGSize{
|
||||||
width = 10.2f, height = 10.2f,
|
width = 10.2f,
|
||||||
|
height = 10.2f,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGSize _measureCeil(YGNodeRef node,
|
static YGSize _measureCeil(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
return YGSize{
|
return YGSize{
|
||||||
width = 10.5f, height = 10.5f,
|
width = 10.5f,
|
||||||
|
height = 10.5f,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGSize _measureFractial(YGNodeRef node,
|
static YGSize _measureFractial(
|
||||||
float width,
|
YGNodeRef node,
|
||||||
YGMeasureMode widthMode,
|
float width,
|
||||||
float height,
|
YGMeasureMode widthMode,
|
||||||
YGMeasureMode heightMode) {
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
return YGSize{
|
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);
|
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 YGConfigRef config = YGConfigNew();
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGSizeOverflowTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
@@ -12,21 +12,16 @@ TEST(YogaTest, pre_order_traversal) {
|
|||||||
YGNodeRef const root_child0 = YGNodeNew();
|
YGNodeRef const root_child0 = YGNodeNew();
|
||||||
YGNodeRef const root_child1 = YGNodeNew();
|
YGNodeRef const root_child1 = YGNodeNew();
|
||||||
YGNodeRef const root_child0_child0 = YGNodeNew();
|
YGNodeRef const root_child0_child0 = YGNodeNew();
|
||||||
|
|
||||||
YGNodeSetChildren(root, {root_child0, root_child1});
|
YGNodeSetChildren(root, {root_child0, root_child1});
|
||||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
std::vector<YGNodeRef> visited;
|
std::vector<YGNodeRef> visited;
|
||||||
YGTraversePreOrder(root, [&visited](YGNodeRef node) {
|
YGTraversePreOrder(
|
||||||
visited.push_back(node);
|
root, [&visited](YGNodeRef node) { visited.push_back(node); });
|
||||||
});
|
|
||||||
|
|
||||||
const std::vector<YGNodeRef> expected = {
|
const std::vector<YGNodeRef> expected = {
|
||||||
root,
|
root, root_child0, root_child0_child0, root_child1};
|
||||||
root_child0,
|
|
||||||
root_child0_child0,
|
|
||||||
root_child1
|
|
||||||
};
|
|
||||||
ASSERT_EQ(visited, expected);
|
ASSERT_EQ(visited, expected);
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
@@ -7,12 +7,11 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static std::vector<YGNodeRef> getChildren(YGNodeRef const node)
|
static std::vector<YGNodeRef> getChildren(YGNodeRef const node) {
|
||||||
{
|
|
||||||
const uint32_t count = YGNodeGetChildCount(node);
|
const uint32_t count = YGNodeGetChildCount(node);
|
||||||
std::vector<YGNodeRef> children;
|
std::vector<YGNodeRef> children;
|
||||||
children.reserve(count);
|
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));
|
children.push_back(YGNodeGetChild(node, i));
|
||||||
}
|
}
|
||||||
return children;
|
return children;
|
||||||
@@ -29,7 +28,8 @@ TEST(YogaTest, set_children_adds_children_to_parent) {
|
|||||||
const std::vector<YGNodeRef> expectedChildren = {root_child0, root_child1};
|
const std::vector<YGNodeRef> expectedChildren = {root_child0, root_child1};
|
||||||
ASSERT_EQ(children, expectedChildren);
|
ASSERT_EQ(children, expectedChildren);
|
||||||
|
|
||||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||||
|
YGNodeGetOwner(root_child1)};
|
||||||
const std::vector<YGNodeRef> expectedOwners = {root, root};
|
const std::vector<YGNodeRef> expectedOwners = {root, root};
|
||||||
ASSERT_EQ(owners, expectedOwners);
|
ASSERT_EQ(owners, expectedOwners);
|
||||||
|
|
||||||
@@ -48,7 +48,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) {
|
|||||||
const std::vector<YGNodeRef> expectedChildren = {};
|
const std::vector<YGNodeRef> expectedChildren = {};
|
||||||
ASSERT_EQ(children, expectedChildren);
|
ASSERT_EQ(children, expectedChildren);
|
||||||
|
|
||||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||||
|
YGNodeGetOwner(root_child1)};
|
||||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||||
ASSERT_EQ(owners, expectedOwners);
|
ASSERT_EQ(owners, expectedOwners);
|
||||||
|
|
||||||
@@ -71,7 +72,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) {
|
|||||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child3};
|
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child3};
|
||||||
ASSERT_EQ(children, expectedChildren);
|
ASSERT_EQ(children, expectedChildren);
|
||||||
|
|
||||||
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)};
|
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||||
|
YGNodeGetOwner(root_child1)};
|
||||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
const std::vector<YGNodeRef> expectedOwners = {nullptr, nullptr};
|
||||||
ASSERT_EQ(owners, expectedOwners);
|
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});
|
YGNodeSetChildren(root, {root_child2, root_child1, root_child3});
|
||||||
|
|
||||||
const std::vector<YGNodeRef> children = getChildren(root);
|
const std::vector<YGNodeRef> children = getChildren(root);
|
||||||
const std::vector<YGNodeRef> expectedChildren = {root_child2, root_child1, root_child3};
|
const std::vector<YGNodeRef> expectedChildren = {
|
||||||
|
root_child2, root_child1, root_child3};
|
||||||
ASSERT_EQ(children, expectedChildren);
|
ASSERT_EQ(children, expectedChildren);
|
||||||
|
|
||||||
const std::vector<YGNodeRef> owners = {
|
const std::vector<YGNodeRef> owners = {YGNodeGetOwner(root_child0),
|
||||||
YGNodeGetOwner(root_child0),
|
YGNodeGetOwner(root_child1),
|
||||||
YGNodeGetOwner(root_child1),
|
YGNodeGetOwner(root_child2),
|
||||||
YGNodeGetOwner(root_child2),
|
YGNodeGetOwner(root_child3)};
|
||||||
YGNodeGetOwner(root_child3)
|
|
||||||
};
|
|
||||||
const std::vector<YGNodeRef> expectedOwners = {nullptr, root, root, root};
|
const std::vector<YGNodeRef> expectedOwners = {nullptr, root, root, root};
|
||||||
ASSERT_EQ(owners, expectedOwners);
|
ASSERT_EQ(owners, expectedOwners);
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
|
Reference in New Issue
Block a user