Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
aa5b296ac7 | ||
|
f2b5d0fef7 | ||
|
0684795a89 | ||
|
2ffc23f400 | ||
|
dc4d16401f | ||
|
849de89a58 | ||
|
f8a2903d02 | ||
|
60977de242 | ||
|
cb612bcfbe | ||
|
6be1c2cdb4 | ||
|
034ab0b3b1 | ||
|
8c50347f3c | ||
|
9f76fb6980 | ||
|
8b0ff0a25c | ||
|
8891ea1a7a | ||
|
ede2ad94bc | ||
|
eacf3cdbb4 | ||
|
3569a13b74 | ||
|
b2a96ec744 | ||
|
a505adb2b7 | ||
|
906b6e52f8 | ||
|
3292337754 | ||
|
eb4af86e3c | ||
|
1b3e971549 | ||
|
4615eee2d8 | ||
|
7c57245943 | ||
|
0d100ad7e9 | ||
|
0235789863 | ||
|
c080a46571 | ||
|
5f050cb590 |
@@ -1,7 +1,7 @@
|
|||||||
[cxx]
|
[cxx]
|
||||||
gtest_dep = //lib/gtest:gtest
|
gtest_dep = //lib/gtest:gtest
|
||||||
[android]
|
[android]
|
||||||
target = Google Inc.:Google APIs:19
|
target = android-23
|
||||||
[ndk]
|
[ndk]
|
||||||
ndk_version = 13.1.3345770
|
ndk_version = 13.1.3345770
|
||||||
compiler = clang
|
compiler = clang
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -63,3 +63,5 @@ Carthage/Build
|
|||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
.gradle
|
.gradle
|
||||||
|
# NDK/CMake
|
||||||
|
.externalNativeBuild
|
||||||
|
17
CMakeLists.txt
Normal file
17
CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
|
file(GLOB yogacore_SRC yoga/*.c)
|
||||||
|
add_library(yogacore STATIC ${yogacore_SRC})
|
||||||
|
|
||||||
|
target_link_libraries(yogacore android log)
|
@@ -10,6 +10,11 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <yoga/YGEnums.h>
|
#import <yoga/YGEnums.h>
|
||||||
|
|
||||||
|
typedef NS_OPTIONS(NSInteger, YGDimensionFlexibility) {
|
||||||
|
YGDimensionFlexibilityFlexibleWidth = 1 << 0,
|
||||||
|
YGDimensionFlexibilityFlexibleHeigth = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
@interface YGLayout : NSObject
|
@interface YGLayout : NSObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,6 +100,13 @@
|
|||||||
- (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin
|
- (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin
|
||||||
NS_SWIFT_NAME(applyLayout(preservingOrigin:));
|
NS_SWIFT_NAME(applyLayout(preservingOrigin:));
|
||||||
|
|
||||||
|
/**
|
||||||
|
Perform a layout calculation and update the frames of the views in the hierarchy with the results.
|
||||||
|
If the origin is not preserved, the root view's layout results will applied from {0,0}.
|
||||||
|
*/
|
||||||
|
- (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin dimensionFlexibility:(YGDimensionFlexibility)dimensionFlexibility
|
||||||
|
NS_SWIFT_NAME(applyLayout(preservingOrigin:dimensionFlexibility:));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the view if no constraints were given. This could equivalent to calling [self
|
Returns the size of the view if no constraints were given. This could equivalent to calling [self
|
||||||
sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
||||||
|
@@ -235,6 +235,20 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio)
|
|||||||
YGApplyLayoutToViewHierarchy(self.view, preserveOrigin);
|
YGApplyLayoutToViewHierarchy(self.view, preserveOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)applyLayoutPreservingOrigin:(BOOL)preserveOrigin dimensionFlexibility:(YGDimensionFlexibility)dimensionFlexibility
|
||||||
|
{
|
||||||
|
CGSize size = self.view.bounds.size;
|
||||||
|
if (dimensionFlexibility & YGDimensionFlexibilityFlexibleWidth) {
|
||||||
|
size.width = YGUndefined;
|
||||||
|
}
|
||||||
|
if (dimensionFlexibility & YGDimensionFlexibilityFlexibleHeigth) {
|
||||||
|
size.height = YGUndefined;
|
||||||
|
}
|
||||||
|
[self calculateLayoutWithSize:size];
|
||||||
|
YGApplyLayoutToViewHierarchy(self.view, NO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (CGSize)intrinsicSize
|
- (CGSize)intrinsicSize
|
||||||
{
|
{
|
||||||
const CGSize constrainedSize = {
|
const CGSize constrainedSize = {
|
||||||
|
@@ -21,7 +21,8 @@
|
|||||||
- (void)testConfigureLayoutIsNoOpWithNilBlock
|
- (void)testConfigureLayoutIsNoOpWithNilBlock
|
||||||
{
|
{
|
||||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
XCTAssertNoThrow([view configureLayoutWithBlock:nil]);
|
id block = nil;
|
||||||
|
XCTAssertNoThrow([view configureLayoutWithBlock:block]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testConfigureLayoutBlockWorksWithValidBlock
|
- (void)testConfigureLayoutBlockWorksWithValidBlock
|
||||||
@@ -153,6 +154,54 @@
|
|||||||
XCTAssertEqual(25, view2.frame.origin.y);
|
XCTAssertEqual(25, view2.frame.origin.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)testContainerWithFlexibleWidthGetsCorrectlySized
|
||||||
|
{
|
||||||
|
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0,0,200,200)];
|
||||||
|
container.yoga.isEnabled = YES;
|
||||||
|
|
||||||
|
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||||
|
view.yoga.isEnabled = YES;
|
||||||
|
view.yoga.width = 100;
|
||||||
|
view.yoga.height = 100;
|
||||||
|
[container addSubview:view];
|
||||||
|
|
||||||
|
[container.yoga applyLayoutPreservingOrigin:YES dimensionFlexibility:YGDimensionFlexibilityFlexibleWidth];
|
||||||
|
XCTAssertEqual(100, container.frame.size.width);
|
||||||
|
XCTAssertEqual(200, container.frame.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testContainerWithFlexibleHeightGetsCorrectlySized
|
||||||
|
{
|
||||||
|
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0,0,200,200)];
|
||||||
|
container.yoga.isEnabled = YES;
|
||||||
|
|
||||||
|
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||||
|
view.yoga.isEnabled = YES;
|
||||||
|
view.yoga.width = 100;
|
||||||
|
view.yoga.height = 100;
|
||||||
|
[container addSubview:view];
|
||||||
|
|
||||||
|
[container.yoga applyLayoutPreservingOrigin:YES dimensionFlexibility:YGDimensionFlexibilityFlexibleHeigth];
|
||||||
|
XCTAssertEqual(200, container.frame.size.width);
|
||||||
|
XCTAssertEqual(100, container.frame.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)testContainerWithFlexibleWidthAndHeightGetsCorrectlySized
|
||||||
|
{
|
||||||
|
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0,0,200,200)];
|
||||||
|
container.yoga.isEnabled = YES;
|
||||||
|
|
||||||
|
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||||
|
view.yoga.isEnabled = YES;
|
||||||
|
view.yoga.width = 100;
|
||||||
|
view.yoga.height = 100;
|
||||||
|
[container addSubview:view];
|
||||||
|
|
||||||
|
[container.yoga applyLayoutPreservingOrigin:YES dimensionFlexibility:YGDimensionFlexibilityFlexibleWidth | YGDimensionFlexibilityFlexibleHeigth];
|
||||||
|
XCTAssertEqual(100, container.frame.size.width);
|
||||||
|
XCTAssertEqual(100, container.frame.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)testMarkingDirtyOnlyWorksOnLeafNodes
|
- (void)testMarkingDirtyOnlyWorksOnLeafNodes
|
||||||
{
|
{
|
||||||
UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
|
@@ -30,7 +30,3 @@ android_resource(
|
|||||||
"PUBLIC",
|
"PUBLIC",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
project_config(
|
|
||||||
src_target = ":android",
|
|
||||||
)
|
|
||||||
|
@@ -1,31 +1,28 @@
|
|||||||
apply plugin: "com.jfrog.bintray"
|
apply plugin: 'com.jfrog.bintray'
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
targetCompatibility = '1.7'
|
version = '1.4.1'
|
||||||
sourceCompatibility = '1.7'
|
|
||||||
|
|
||||||
version = '1.3.0'
|
|
||||||
group = 'com.facebook.yoga.android'
|
group = 'com.facebook.yoga.android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
buildToolsVersion "19.1.0"
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 15
|
minSdkVersion rootProject.minSdkVersion
|
||||||
targetSdkVersion 19
|
targetSdkVersion rootProject.targetSdkVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
targetCompatibility rootProject.targetCompatibilityVersion
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility rootProject.sourceCompatibilityVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.facebook.yoga:yoga:1.2.0'
|
compile project(':yoga')
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
@@ -46,7 +43,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
bintrayName = "com.facebook.yoga.android:yoga-layout"
|
bintrayName = 'com.facebook.yoga.android:yoga-layout'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
||||||
|
@@ -33,7 +33,3 @@ keystore(
|
|||||||
properties = "debug.keystore.properties",
|
properties = "debug.keystore.properties",
|
||||||
store = "debug.keystore",
|
store = "debug.keystore",
|
||||||
)
|
)
|
||||||
|
|
||||||
project_config(
|
|
||||||
src_target = ":sample",
|
|
||||||
)
|
|
||||||
|
@@ -37,7 +37,7 @@ import com.facebook.yoga.YogaMeasureFunction;
|
|||||||
import com.facebook.yoga.YogaMeasureMode;
|
import com.facebook.yoga.YogaMeasureMode;
|
||||||
import com.facebook.yoga.YogaMeasureOutput;
|
import com.facebook.yoga.YogaMeasureOutput;
|
||||||
import com.facebook.yoga.YogaNode;
|
import com.facebook.yoga.YogaNode;
|
||||||
import com.facebook.yoga.YogaNodeAPI;
|
import com.facebook.yoga.YogaNode;
|
||||||
import com.facebook.yoga.YogaOverflow;
|
import com.facebook.yoga.YogaOverflow;
|
||||||
import com.facebook.yoga.YogaPositionType;
|
import com.facebook.yoga.YogaPositionType;
|
||||||
import com.facebook.yoga.YogaWrap;
|
import com.facebook.yoga.YogaWrap;
|
||||||
@@ -789,7 +789,7 @@ public class YogaLayout extends ViewGroup {
|
|||||||
* @return A measurement output ({@code YogaMeasureOutput}) for the node
|
* @return A measurement output ({@code YogaMeasureOutput}) for the node
|
||||||
*/
|
*/
|
||||||
public long measure(
|
public long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
|
17
build.gradle
17
build.gradle
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.2.2'
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
|
||||||
classpath 'com.nabilhachicha:android-native-dependencies:0.1'
|
classpath 'com.nabilhachicha:android-native-dependencies:0.1'
|
||||||
@@ -18,15 +18,18 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
flatDir {
|
|
||||||
dirs "${rootDir}/lib/jsr-305"
|
|
||||||
dirs "${rootDir}/lib/soloader"
|
|
||||||
dirs "${rootDir}/lib/appcompat"
|
|
||||||
dirs "${rootDir}/lib/android-support"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
minSdkVersion = 15
|
||||||
|
targetSdkVersion = 25
|
||||||
|
compileSdkVersion = 25
|
||||||
|
buildToolsVersion = '25.0.2'
|
||||||
|
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||||
|
targetCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||||
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
@@ -26,8 +26,8 @@ namespace Facebook.Yoga
|
|||||||
{
|
{
|
||||||
public partial class YogaNode : IEnumerable<YogaNode>
|
public partial class YogaNode : IEnumerable<YogaNode>
|
||||||
{
|
{
|
||||||
private Native.YGNodeHandle _ygNode;
|
private readonly Native.YGNodeHandle _ygNode;
|
||||||
private YogaConfig _config;
|
private readonly YogaConfig _config;
|
||||||
private WeakReference _parent;
|
private WeakReference _parent;
|
||||||
private List<YogaNode> _children;
|
private List<YogaNode> _children;
|
||||||
private MeasureFunction _measureFunction;
|
private MeasureFunction _measureFunction;
|
||||||
@@ -447,7 +447,7 @@ namespace Facebook.Yoga
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float StyleAspectRatio
|
public float AspectRatio
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -576,6 +576,20 @@ namespace Facebook.Yoga
|
|||||||
Native.YGNodeRemoveChild(_ygNode, child._ygNode);
|
Native.YGNodeRemoveChild(_ygNode, child._ygNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddChild(YogaNode child)
|
||||||
|
{
|
||||||
|
Insert(Count, child);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveChild(YogaNode child)
|
||||||
|
{
|
||||||
|
int index = IndexOf(child);
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
RemoveAt(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
if (_children != null)
|
if (_children != null)
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
|
[System.Flags]
|
||||||
public enum YogaPrintOptions
|
public enum YogaPrintOptions
|
||||||
{
|
{
|
||||||
Layout = 1,
|
Layout = 1,
|
||||||
|
@@ -243,6 +243,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\yoga\Yoga.h" />
|
<ClInclude Include="..\..\yoga\Yoga.h" />
|
||||||
|
<ClInclude Include="..\..\yoga\YGEnums.c" />
|
||||||
<ClInclude Include="..\..\yoga\YGMacros.h" />
|
<ClInclude Include="..\..\yoga\YGMacros.h" />
|
||||||
<ClInclude Include="..\..\yoga\YGNodeList.h" />
|
<ClInclude Include="..\..\yoga\YGNodeList.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
@@ -252,6 +253,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\yoga\Yoga.c" />
|
<ClCompile Include="..\..\yoga\Yoga.c" />
|
||||||
|
<ClCompile Include="..\..\yoga\YGEnums.c" />
|
||||||
<ClCompile Include="..\..\yoga\YGNodeList.c" />
|
<ClCompile Include="..\..\yoga\YGNodeList.c" />
|
||||||
<ClCompile Include="YGInterop.cpp" />
|
<ClCompile Include="YGInterop.cpp" />
|
||||||
<ClCompile Include="dllmain.cpp">
|
<ClCompile Include="dllmain.cpp">
|
||||||
|
@@ -228,6 +228,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\yoga\Yoga.h" />
|
<ClInclude Include="..\..\yoga\Yoga.h" />
|
||||||
|
<ClInclude Include="..\..\yoga\YGEnums.h" />
|
||||||
<ClInclude Include="..\..\yoga\YGMacros.h" />
|
<ClInclude Include="..\..\yoga\YGMacros.h" />
|
||||||
<ClInclude Include="..\..\yoga\YGNodeList.h" />
|
<ClInclude Include="..\..\yoga\YGNodeList.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
@@ -237,6 +238,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\yoga\Yoga.c" />
|
<ClCompile Include="..\..\yoga\Yoga.c" />
|
||||||
|
<ClCompile Include="..\..\yoga\YGEnums.c" />
|
||||||
<ClCompile Include="..\..\yoga\YGNodeList.c" />
|
<ClCompile Include="..\..\yoga\YGNodeList.c" />
|
||||||
<ClCompile Include="YGInterop.cpp" />
|
<ClCompile Include="YGInterop.cpp" />
|
||||||
<ClCompile Include="dllmain.cpp">
|
<ClCompile Include="dllmain.cpp">
|
||||||
|
@@ -475,6 +475,99 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
|
Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_flex_grow_child()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.FlexBasis = 0;
|
||||||
|
root_child0.Height = 100;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_flex_grow_within_constrained_min_max_column()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.MinHeight = 100;
|
||||||
|
root.MaxHeight = 200;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.Height = 50;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_flex_grow_within_max_width()
|
public void Test_flex_grow_within_max_width()
|
||||||
{
|
{
|
||||||
@@ -957,113 +1050,5 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_min_width_in_flex_distribution()
|
|
||||||
{
|
|
||||||
YogaConfig config = new YogaConfig();
|
|
||||||
|
|
||||||
YogaNode root = new YogaNode(config);
|
|
||||||
root.FlexDirection = YogaFlexDirection.Row;
|
|
||||||
root.Width = 300;
|
|
||||||
root.Height = 300;
|
|
||||||
|
|
||||||
YogaNode root_child0 = new YogaNode(config);
|
|
||||||
root_child0.FlexGrow = 2;
|
|
||||||
root_child0.FlexShrink = 1;
|
|
||||||
root_child0.FlexBasis = 0.Percent();
|
|
||||||
root_child0.MinWidth = 100;
|
|
||||||
root_child0.MaxWidth = 200;
|
|
||||||
root.Insert(0, root_child0);
|
|
||||||
|
|
||||||
YogaNode root_child1 = new YogaNode(config);
|
|
||||||
root_child1.FlexGrow = 1;
|
|
||||||
root_child1.FlexShrink = 1;
|
|
||||||
root_child1.FlexBasis = 0.Percent();
|
|
||||||
root.Insert(1, root_child1);
|
|
||||||
|
|
||||||
YogaNode root_child2 = new YogaNode(config);
|
|
||||||
root_child2.FlexGrow = 1;
|
|
||||||
root_child2.FlexShrink = 1;
|
|
||||||
root_child2.FlexBasis = 0.Percent();
|
|
||||||
root.Insert(2, root_child2);
|
|
||||||
|
|
||||||
YogaNode root_child3 = new YogaNode(config);
|
|
||||||
root_child3.FlexGrow = 1;
|
|
||||||
root_child3.FlexShrink = 1;
|
|
||||||
root_child3.FlexBasis = 0.Percent();
|
|
||||||
root.Insert(3, root_child3);
|
|
||||||
|
|
||||||
YogaNode root_child4 = new YogaNode(config);
|
|
||||||
root_child4.FlexGrow = 1;
|
|
||||||
root_child4.FlexShrink = 1;
|
|
||||||
root_child4.FlexBasis = 0.Percent();
|
|
||||||
root.Insert(4, root_child4);
|
|
||||||
root.StyleDirection = YogaDirection.LTR;
|
|
||||||
root.CalculateLayout();
|
|
||||||
|
|
||||||
Assert.AreEqual(0f, root.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root.LayoutY);
|
|
||||||
Assert.AreEqual(300f, root.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child0.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(100f, root_child1.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child1.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(150f, root_child2.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child2.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child2.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(200f, root_child3.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child3.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child3.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(250f, root_child4.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child4.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child4.LayoutHeight);
|
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
|
||||||
root.CalculateLayout();
|
|
||||||
|
|
||||||
Assert.AreEqual(0f, root.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root.LayoutY);
|
|
||||||
Assert.AreEqual(300f, root.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(200f, root_child0.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child0.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(150f, root_child1.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child1.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(100f, root_child2.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child2.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child2.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(50f, root_child3.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child3.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child3.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child3.LayoutHeight);
|
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child4.LayoutX);
|
|
||||||
Assert.AreEqual(0f, root_child4.LayoutY);
|
|
||||||
Assert.AreEqual(50f, root_child4.LayoutWidth);
|
|
||||||
Assert.AreEqual(300f, root_child4.LayoutHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -684,17 +684,17 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(64f, root_child0.LayoutHeight);
|
Assert.AreEqual(65f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(64f, root_child1.LayoutY);
|
Assert.AreEqual(64f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(25f, root_child1.LayoutHeight);
|
Assert.AreEqual(24f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
Assert.AreEqual(89f, root_child2.LayoutY);
|
Assert.AreEqual(89f, root_child2.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child2.LayoutWidth);
|
Assert.AreEqual(100f, root_child2.LayoutWidth);
|
||||||
Assert.AreEqual(24f, root_child2.LayoutHeight);
|
Assert.AreEqual(25f, root_child2.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -707,17 +707,17 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(64f, root_child0.LayoutHeight);
|
Assert.AreEqual(65f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(64f, root_child1.LayoutY);
|
Assert.AreEqual(64f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(25f, root_child1.LayoutHeight);
|
Assert.AreEqual(24f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child2.LayoutX);
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
Assert.AreEqual(89f, root_child2.LayoutY);
|
Assert.AreEqual(89f, root_child2.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child2.LayoutWidth);
|
Assert.AreEqual(100f, root_child2.LayoutWidth);
|
||||||
Assert.AreEqual(24f, root_child2.LayoutHeight);
|
Assert.AreEqual(25f, root_child2.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -793,5 +793,308 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(24f, root_child2.LayoutHeight);
|
Assert.AreEqual(24f, root_child2.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_rounding_inner_node_controversy_horizontal()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 320;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.Height = 10;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.Height = 10;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
|
||||||
|
YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.FlexGrow = 1;
|
||||||
|
root_child1_child0.Height = 10;
|
||||||
|
root_child1.Insert(0, root_child1_child0);
|
||||||
|
|
||||||
|
YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.FlexGrow = 1;
|
||||||
|
root_child2.Height = 10;
|
||||||
|
root.Insert(2, root_child2);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(320f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(107f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(107f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(106f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(106f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(213f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(107f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(320f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(213f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(107f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(107f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(106f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(106f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(107f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(10f, root_child2.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_rounding_inner_node_controversy_vertical()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.Height = 320;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.Width = 10;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.Width = 10;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
|
||||||
|
YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.FlexGrow = 1;
|
||||||
|
root_child1_child0.Width = 10;
|
||||||
|
root_child1.Insert(0, root_child1_child0);
|
||||||
|
|
||||||
|
YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.FlexGrow = 1;
|
||||||
|
root_child2.Width = 10;
|
||||||
|
root.Insert(2, root_child2);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(107f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(213f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child2.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(107f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(213f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(10f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child2.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_rounding_inner_node_controversy_combined()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 640;
|
||||||
|
root.Height = 320;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.Height = 100.Percent();
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.Height = 100.Percent();
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
|
||||||
|
YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.FlexGrow = 1;
|
||||||
|
root_child1_child0.Width = 100.Percent();
|
||||||
|
root_child1.Insert(0, root_child1_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1_child1 = new YogaNode(config);
|
||||||
|
root_child1_child1.FlexGrow = 1;
|
||||||
|
root_child1_child1.Width = 100.Percent();
|
||||||
|
root_child1.Insert(1, root_child1_child1);
|
||||||
|
|
||||||
|
YogaNode root_child1_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child1_child0.FlexGrow = 1;
|
||||||
|
root_child1_child1_child0.Width = 100.Percent();
|
||||||
|
root_child1_child1.Insert(0, root_child1_child1_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1_child2 = new YogaNode(config);
|
||||||
|
root_child1_child2.FlexGrow = 1;
|
||||||
|
root_child1_child2.Width = 100.Percent();
|
||||||
|
root_child1.Insert(2, root_child1_child2);
|
||||||
|
|
||||||
|
YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.FlexGrow = 1;
|
||||||
|
root_child2.Height = 100.Percent();
|
||||||
|
root.Insert(2, root_child2);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(640f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(213f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(213f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child1.LayoutX);
|
||||||
|
Assert.AreEqual(107f, root_child1_child1.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child2.LayoutX);
|
||||||
|
Assert.AreEqual(213f, root_child1_child2.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child1_child2.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(427f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(213f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child2.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(640f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(427f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(213f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(213f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child1.LayoutX);
|
||||||
|
Assert.AreEqual(107f, root_child1_child1.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(106f, root_child1_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child2.LayoutX);
|
||||||
|
Assert.AreEqual(213f, root_child1_child2.LayoutY);
|
||||||
|
Assert.AreEqual(214f, root_child1_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(107f, root_child1_child2.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(213f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(320f, root_child2.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -188,7 +188,7 @@ enum YogaMeasureMode {
|
|||||||
|
|
||||||
interface YogaMeasureFunction {
|
interface YogaMeasureFunction {
|
||||||
long measure(
|
long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
|
2
enums.py
2
enums.py
@@ -223,6 +223,8 @@ for name, values in sorted(ENUMS.items()):
|
|||||||
with open(root + '/csharp/Facebook.Yoga/Yoga%s.cs' % name, 'w') as f:
|
with open(root + '/csharp/Facebook.Yoga/Yoga%s.cs' % name, 'w') as f:
|
||||||
f.write(LICENSE)
|
f.write(LICENSE)
|
||||||
f.write('namespace Facebook.Yoga\n{\n')
|
f.write('namespace Facebook.Yoga\n{\n')
|
||||||
|
if isinstance(next(iter(values or []), None), tuple):
|
||||||
|
f.write(' [System.Flags]\n')
|
||||||
f.write(' public enum Yoga%s\n {\n' % name)
|
f.write(' public enum Yoga%s\n {\n' % name)
|
||||||
for value in values:
|
for value in values:
|
||||||
if isinstance(value, tuple):
|
if isinstance(value, tuple):
|
||||||
|
@@ -41,6 +41,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_grow_child" style="flex-direction: row;">
|
||||||
|
<div style="height: 100px; flex-grow: 1; flex-basis: 0px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_grow_within_constrained_min_max_column" style="min-height: 100px; max-height: 200px">
|
||||||
|
<div style="flex-grow:1;"></div>
|
||||||
|
<div style="height: 50px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="flex_grow_within_max_width" style="width: 200px; height: 100px;">
|
<div id="flex_grow_within_max_width" style="width: 200px; height: 100px;">
|
||||||
<div style="flex-direction: row; max-width: 100px;">
|
<div style="flex-direction: row; max-width: 100px;">
|
||||||
<div style="height: 20px; flex-grow: 1;"></div>
|
<div style="height: 20px; flex-grow: 1;"></div>
|
||||||
|
@@ -62,3 +62,34 @@
|
|||||||
<div style="height: 10px; flex-grow:1;"></div>
|
<div style="height: 10px; flex-grow:1;"></div>
|
||||||
<div style="height: 10px; flex-grow:1;"></div>
|
<div style="height: 10px; flex-grow:1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="rounding_inner_node_controversy_horizontal" experiments="Rounding" style="width: 320px; flex-direction: row;">
|
||||||
|
<div style="height: 10px; flex-grow:1;"></div>
|
||||||
|
<div style="height: 10px; flex-grow:1;">
|
||||||
|
<div style="height: 10px; flex-grow:1;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 10px; flex-grow:1;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="rounding_inner_node_controversy_vertical" experiments="Rounding" style="height: 320px;">
|
||||||
|
<div style="width: 10px; flex-grow:1;"></div>
|
||||||
|
<div style="width: 10px; flex-grow:1;">
|
||||||
|
<div style="width: 10px; flex-grow:1;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 10px; flex-grow:1;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="rounding_inner_node_controversy_combined" experiments="Rounding" style="width: 640px; height: 320px; flex-direction: row;">
|
||||||
|
<div style="height: 100%; flex-grow:1;"></div>
|
||||||
|
<div style="height: 100%; flex-grow:1; flex-direction: column;">
|
||||||
|
<div style="width: 100%; flex-grow:1;"></div>
|
||||||
|
<div style="width: 100%; flex-grow:1;">
|
||||||
|
<div style="flex-grow:1; width: 100%;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 100%; flex-grow:1;"></div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 100%; flex-grow:1;"></div>
|
||||||
|
</div>
|
||||||
|
@@ -420,25 +420,46 @@ function getDefaultStyleValue(style) {
|
|||||||
return getComputedStyle(node, null).getPropertyValue(style);
|
return getComputedStyle(node, null).getPropertyValue(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateTree(root) {
|
function getRoundedSize(node) {
|
||||||
|
var boundingRect = node.getBoundingClientRect();
|
||||||
|
return {
|
||||||
|
width: Math.round(boundingRect.right) - Math.round(boundingRect.left),
|
||||||
|
height: Math.round(boundingRect.bottom) - Math.round(boundingRect.top)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTree(root, roundToPixelGrid) {
|
||||||
var rootLayout = [];
|
var rootLayout = [];
|
||||||
|
|
||||||
|
// Any occurrence of "Rounding" mark during node tree traverse turns this feature on for whole subtree.
|
||||||
|
if ((root.getAttribute('experiments') || '').split(' ').indexOf('Rounding') != -1) {
|
||||||
|
roundToPixelGrid = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < root.children.length; i++) {
|
for (var i = 0; i < root.children.length; i++) {
|
||||||
var child = root.children[i];
|
var child = root.children[i];
|
||||||
rootLayout.push({
|
var layout = {
|
||||||
name: child.id !== '' ? child.id : 'INSERT_NAME_HERE',
|
name: child.id !== '' ? child.id : 'INSERT_NAME_HERE',
|
||||||
left: child.offsetLeft + child.parentNode.clientLeft,
|
left: child.offsetLeft + child.parentNode.clientLeft,
|
||||||
top: child.offsetTop + child.parentNode.clientTop,
|
top: child.offsetTop + child.parentNode.clientTop,
|
||||||
width: child.offsetWidth,
|
width: child.offsetWidth,
|
||||||
height: child.offsetHeight,
|
height: child.offsetHeight,
|
||||||
children: calculateTree(child),
|
children: calculateTree(child, roundToPixelGrid),
|
||||||
style: getYogaStyle(child),
|
style: getYogaStyle(child),
|
||||||
declaredStyle: child.style,
|
declaredStyle: child.style,
|
||||||
rawStyle: child.getAttribute('style'),
|
rawStyle: child.getAttribute('style'),
|
||||||
experiments: child.getAttribute('experiments')
|
experiments: child.getAttribute('experiments')
|
||||||
? child.getAttribute('experiments').split(' ')
|
? child.getAttribute('experiments').split(' ')
|
||||||
: [],
|
: [],
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (roundToPixelGrid) {
|
||||||
|
var size = getRoundedSize(child);
|
||||||
|
layout.width = size.width;
|
||||||
|
layout.height = size.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
rootLayout.push(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rootLayout;
|
return rootLayout;
|
||||||
|
4
gradle.properties
Normal file
4
gradle.properties
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
bintrayUsername=
|
||||||
|
bintrayApiKey=
|
||||||
|
bintrayGpgPassword=
|
||||||
|
dryRun=false
|
@@ -12,19 +12,19 @@ ext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def getBintrayUsername() {
|
def getBintrayUsername() {
|
||||||
return hasProperty('bintrayUsername') ? property('bintrayUsername') : System.getenv('BINTRAY_USERNAME')
|
return property('bintrayUsername') || System.getenv('BINTRAY_USERNAME')
|
||||||
}
|
}
|
||||||
|
|
||||||
def getBintrayApiKey() {
|
def getBintrayApiKey() {
|
||||||
return hasProperty('bintrayApiKey') ? property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
return property('bintrayApiKey') || System.getenv('BINTRAY_API_KEY')
|
||||||
}
|
}
|
||||||
|
|
||||||
def getBintrayGpgPassword() {
|
def getBintrayGpgPassword() {
|
||||||
return hasProperty('bintrayGpgPassword') ? property('bintrayGpgPassword') : System.getenv('BINTRAY_GPG_PASSWORD')
|
return property('bintrayGpgPassword') || System.getenv('BINTRAY_GPG_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
def dryRunOnly() {
|
def dryRunOnly() {
|
||||||
return hasProperty('dryRun') ? property('dryRun').toBoolean() : false
|
return hasProperty('dryRun') ? property('dryRun').toBoolean() : false
|
||||||
}
|
}
|
||||||
|
|
||||||
def pomConfig = {
|
def pomConfig = {
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Tue Apr 18 14:49:25 CEST 2017
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
|
172
gradlew
vendored
Executable file
172
gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save ( ) {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
40
java/CMakeLists.txt
Normal file
40
java/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
|
# configure import libs
|
||||||
|
set(libfb_DIR ${CMAKE_SOURCE_DIR}/../lib/fb/src/main/cpp)
|
||||||
|
set(yogacore_DIR ${CMAKE_SOURCE_DIR}/..)
|
||||||
|
|
||||||
|
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||||
|
|
||||||
|
set(libfb_build_DIR ${build_DIR}/libfb/${ANDROID_ABI})
|
||||||
|
set(yogacore_build_DIR ${build_DIR}/yogacore/${ANDROID_ABI})
|
||||||
|
|
||||||
|
file(MAKE_DIRECTORY ${build_DIR})
|
||||||
|
|
||||||
|
add_subdirectory(${libfb_DIR} ${libfb_build_DIR})
|
||||||
|
add_subdirectory(${yogacore_DIR} ${yogacore_build_DIR})
|
||||||
|
|
||||||
|
add_compile_options(
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
-fexceptions
|
||||||
|
-Wall
|
||||||
|
-std=c++11)
|
||||||
|
|
||||||
|
add_library(yoga SHARED jni/YGJNI.cpp)
|
||||||
|
|
||||||
|
target_include_directories(yoga PRIVATE
|
||||||
|
${libfb_DIR}/include
|
||||||
|
${yogacore_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(yoga yogacore fb)
|
@@ -1,32 +1,39 @@
|
|||||||
apply plugin: "com.jfrog.bintray"
|
apply plugin: 'com.jfrog.bintray'
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'com.github.dcendents.android-maven'
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
targetCompatibility = '1.7'
|
version = '1.4.2'
|
||||||
sourceCompatibility = '1.7'
|
|
||||||
|
|
||||||
version = '1.3.1'
|
|
||||||
group = 'com.facebook.yoga'
|
group = 'com.facebook.yoga'
|
||||||
|
|
||||||
// We currently build the native libraries with buck and bundle them together
|
|
||||||
// at this point into the AAR
|
|
||||||
task buckBuildAndCopy(type: Exec) {
|
|
||||||
commandLine '../scripts/build_natives_for_gradle.sh'
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
buildToolsVersion "19.1.0"
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 15
|
minSdkVersion rootProject.minSdkVersion
|
||||||
targetSdkVersion 19
|
targetSdkVersion rootProject.targetSdkVersion
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path 'CMakeLists.txt'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
targetCompatibility rootProject.targetCompatibilityVersion
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility rootProject.sourceCompatibilityVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -39,12 +46,10 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preBuild.dependsOn buckBuildAndCopy
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(name: 'jsr305')
|
compile 'com.google.code.findbugs:jsr305:3.0.1'
|
||||||
compile(name: 'soloader-0.1.0', ext: 'aar')
|
compile 'com.facebook.soloader:soloader:0.2.0'
|
||||||
provided(project(':yoga:proguard-annotations'))
|
provided project(':yoga:proguard-annotations')
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
@@ -65,7 +70,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
bintrayName = "com.facebook.yoga:yoga"
|
bintrayName = 'com.facebook.yoga:yoga'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
apply from: rootProject.file('gradle/android-jcenter-install.gradle')
|
||||||
|
@@ -18,5 +18,5 @@ public interface YogaBaselineFunction {
|
|||||||
* default to the computed height of the node.
|
* default to the computed height of the node.
|
||||||
*/
|
*/
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
float baseline(YogaNodeAPI node, float width, float height);
|
float baseline(YogaNode node, float width, float height);
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ public interface YogaMeasureFunction {
|
|||||||
*/
|
*/
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
long measure(
|
long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
|
@@ -18,7 +18,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
|||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public class YogaNode implements YogaNodeAPI<YogaNode> {
|
public class YogaNode {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SoLoader.loadLibrary("yoga");
|
SoLoader.loadLibrary("yoga");
|
||||||
@@ -106,7 +106,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeFree(long nativePointer);
|
private native void jni_YGNodeFree(long nativePointer);
|
||||||
@Override
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
try {
|
try {
|
||||||
jni_YGNodeFree(mNativePointer);
|
jni_YGNodeFree(mNativePointer);
|
||||||
@@ -116,7 +115,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeReset(long nativePointer);
|
private native void jni_YGNodeReset(long nativePointer);
|
||||||
@Override
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
mEdgeSetFlag = 0;
|
mEdgeSetFlag = 0;
|
||||||
mHasSetPosition = false;
|
mHasSetPosition = false;
|
||||||
@@ -141,23 +139,21 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
mLayoutDirection = 0;
|
mLayoutDirection = 0;
|
||||||
|
|
||||||
mMeasureFunction = null;
|
mMeasureFunction = null;
|
||||||
|
mBaselineFunction = null;
|
||||||
mData = null;
|
mData = null;
|
||||||
|
|
||||||
jni_YGNodeReset(mNativePointer);
|
jni_YGNodeReset(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getChildCount() {
|
public int getChildCount() {
|
||||||
return mChildren == null ? 0 : mChildren.size();
|
return mChildren == null ? 0 : mChildren.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaNode getChildAt(int i) {
|
public YogaNode getChildAt(int i) {
|
||||||
return mChildren.get(i);
|
return mChildren.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
private native void jni_YGNodeInsertChild(long nativePointer, long childPointer, int index);
|
||||||
@Override
|
|
||||||
public void addChildAt(YogaNode child, int i) {
|
public void addChildAt(YogaNode child, int i) {
|
||||||
if (child.mParent != null) {
|
if (child.mParent != null) {
|
||||||
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
throw new IllegalStateException("Child already has a parent, it must be removed first.");
|
||||||
@@ -172,7 +168,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
private native void jni_YGNodeRemoveChild(long nativePointer, long childPointer);
|
||||||
@Override
|
|
||||||
public YogaNode removeChildAt(int i) {
|
public YogaNode removeChildAt(int i) {
|
||||||
|
|
||||||
final YogaNode child = mChildren.remove(i);
|
final YogaNode child = mChildren.remove(i);
|
||||||
@@ -181,221 +176,184 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable
|
public @Nullable
|
||||||
YogaNode getParent() {
|
YogaNode getParent() {
|
||||||
return mParent;
|
return mParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int indexOf(YogaNode child) {
|
public int indexOf(YogaNode child) {
|
||||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||||
@Override
|
|
||||||
public void calculateLayout(float width, float height) {
|
public void calculateLayout(float width, float height) {
|
||||||
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasNewLayout() {
|
public boolean hasNewLayout() {
|
||||||
return mHasNewLayout;
|
return mHasNewLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeMarkDirty(long nativePointer);
|
private native void jni_YGNodeMarkDirty(long nativePointer);
|
||||||
@Override
|
|
||||||
public void dirty() {
|
public void dirty() {
|
||||||
jni_YGNodeMarkDirty(mNativePointer);
|
jni_YGNodeMarkDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
||||||
@Override
|
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return jni_YGNodeIsDirty(mNativePointer);
|
return jni_YGNodeIsDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
private native void jni_YGNodeCopyStyle(long dstNativePointer, long srcNativePointer);
|
||||||
@Override
|
|
||||||
public void copyStyle(YogaNode srcNode) {
|
public void copyStyle(YogaNode srcNode) {
|
||||||
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
jni_YGNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markLayoutSeen() {
|
public void markLayoutSeen() {
|
||||||
mHasNewLayout = false;
|
mHasNewLayout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaDirection getStyleDirection() {
|
public YogaDirection getStyleDirection() {
|
||||||
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
private native void jni_YGNodeStyleSetDirection(long nativePointer, int direction);
|
||||||
@Override
|
|
||||||
public void setDirection(YogaDirection direction) {
|
public void setDirection(YogaDirection direction) {
|
||||||
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
jni_YGNodeStyleSetDirection(mNativePointer, direction.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaFlexDirection getFlexDirection() {
|
public YogaFlexDirection getFlexDirection() {
|
||||||
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
private native void jni_YGNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
|
||||||
@Override
|
|
||||||
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
public void setFlexDirection(YogaFlexDirection flexDirection) {
|
||||||
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
jni_YGNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaJustify getJustifyContent() {
|
public YogaJustify getJustifyContent() {
|
||||||
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
private native void jni_YGNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
|
||||||
@Override
|
|
||||||
public void setJustifyContent(YogaJustify justifyContent) {
|
public void setJustifyContent(YogaJustify justifyContent) {
|
||||||
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
jni_YGNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignItems() {
|
public YogaAlign getAlignItems() {
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
private native void jni_YGNodeStyleSetAlignItems(long nativePointer, int alignItems);
|
||||||
@Override
|
|
||||||
public void setAlignItems(YogaAlign alignItems) {
|
public void setAlignItems(YogaAlign alignItems) {
|
||||||
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
jni_YGNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignSelf() {
|
public YogaAlign getAlignSelf() {
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
private native void jni_YGNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
|
||||||
@Override
|
|
||||||
public void setAlignSelf(YogaAlign alignSelf) {
|
public void setAlignSelf(YogaAlign alignSelf) {
|
||||||
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
jni_YGNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaAlign getAlignContent() {
|
public YogaAlign getAlignContent() {
|
||||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
private native void jni_YGNodeStyleSetAlignContent(long nativePointer, int alignContent);
|
||||||
@Override
|
|
||||||
public void setAlignContent(YogaAlign alignContent) {
|
public void setAlignContent(YogaAlign alignContent) {
|
||||||
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
jni_YGNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaPositionType getPositionType() {
|
public YogaPositionType getPositionType() {
|
||||||
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
private native void jni_YGNodeStyleSetPositionType(long nativePointer, int positionType);
|
||||||
@Override
|
|
||||||
public void setPositionType(YogaPositionType positionType) {
|
public void setPositionType(YogaPositionType positionType) {
|
||||||
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
jni_YGNodeStyleSetPositionType(mNativePointer, positionType.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
private native void jni_YGNodeStyleSetFlexWrap(long nativePointer, int wrapType);
|
||||||
@Override
|
|
||||||
public void setWrap(YogaWrap flexWrap) {
|
public void setWrap(YogaWrap flexWrap) {
|
||||||
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
jni_YGNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaOverflow getOverflow() {
|
public YogaOverflow getOverflow() {
|
||||||
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||||
@Override
|
|
||||||
public void setOverflow(YogaOverflow overflow) {
|
public void setOverflow(YogaOverflow overflow) {
|
||||||
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaDisplay getDisplay() {
|
public YogaDisplay getDisplay() {
|
||||||
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
||||||
@Override
|
|
||||||
public void setDisplay(YogaDisplay display) {
|
public void setDisplay(YogaDisplay display) {
|
||||||
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
||||||
@Override
|
|
||||||
public void setFlex(float flex) {
|
public void setFlex(float flex) {
|
||||||
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
jni_YGNodeStyleSetFlex(mNativePointer, flex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
private native float jni_YGNodeStyleGetFlexGrow(long nativePointer);
|
||||||
@Override
|
|
||||||
public float getFlexGrow() {
|
public float getFlexGrow() {
|
||||||
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
return jni_YGNodeStyleGetFlexGrow(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
private native void jni_YGNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
|
||||||
@Override
|
|
||||||
public void setFlexGrow(float flexGrow) {
|
public void setFlexGrow(float flexGrow) {
|
||||||
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
jni_YGNodeStyleSetFlexGrow(mNativePointer, flexGrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
private native float jni_YGNodeStyleGetFlexShrink(long nativePointer);
|
||||||
@Override
|
|
||||||
public float getFlexShrink() {
|
public float getFlexShrink() {
|
||||||
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
return jni_YGNodeStyleGetFlexShrink(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
private native void jni_YGNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
|
||||||
@Override
|
|
||||||
public void setFlexShrink(float flexShrink) {
|
public void setFlexShrink(float flexShrink) {
|
||||||
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getFlexBasis() {
|
public YogaValue getFlexBasis() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||||
@Override
|
|
||||||
public void setFlexBasis(float flexBasis) {
|
public void setFlexBasis(float flexBasis) {
|
||||||
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setFlexBasisPercent(float percent) {
|
public void setFlexBasisPercent(float percent) {
|
||||||
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
private native void jni_YGNodeStyleSetFlexBasisAuto(long nativePointer);
|
||||||
@Override
|
|
||||||
public void setFlexBasisAuto() {
|
public void setFlexBasisAuto() {
|
||||||
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
jni_YGNodeStyleSetFlexBasisAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||||
@Override
|
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
public YogaValue getMargin(YogaEdge edge) {
|
||||||
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
if (!((mEdgeSetFlag & MARGIN) == MARGIN)) {
|
||||||
return YogaValue.UNDEFINED;
|
return YogaValue.UNDEFINED;
|
||||||
@@ -404,28 +362,24 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||||
@Override
|
|
||||||
public void setMargin(YogaEdge edge, float margin) {
|
public void setMargin(YogaEdge edge, float margin) {
|
||||||
mEdgeSetFlag |= MARGIN;
|
mEdgeSetFlag |= MARGIN;
|
||||||
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
||||||
@Override
|
|
||||||
public void setMarginPercent(YogaEdge edge, float percent) {
|
public void setMarginPercent(YogaEdge edge, float percent) {
|
||||||
mEdgeSetFlag |= MARGIN;
|
mEdgeSetFlag |= MARGIN;
|
||||||
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
private native void jni_YGNodeStyleSetMarginAuto(long nativePointer, int edge);
|
||||||
@Override
|
|
||||||
public void setMarginAuto(YogaEdge edge) {
|
public void setMarginAuto(YogaEdge edge) {
|
||||||
mEdgeSetFlag |= MARGIN;
|
mEdgeSetFlag |= MARGIN;
|
||||||
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
jni_YGNodeStyleSetMarginAuto(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
||||||
@Override
|
|
||||||
public YogaValue getPadding(YogaEdge edge) {
|
public YogaValue getPadding(YogaEdge edge) {
|
||||||
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
if (!((mEdgeSetFlag & PADDING) == PADDING)) {
|
||||||
return YogaValue.UNDEFINED;
|
return YogaValue.UNDEFINED;
|
||||||
@@ -434,21 +388,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||||
@Override
|
|
||||||
public void setPadding(YogaEdge edge, float padding) {
|
public void setPadding(YogaEdge edge, float padding) {
|
||||||
mEdgeSetFlag |= PADDING;
|
mEdgeSetFlag |= PADDING;
|
||||||
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
||||||
@Override
|
|
||||||
public void setPaddingPercent(YogaEdge edge, float percent) {
|
public void setPaddingPercent(YogaEdge edge, float percent) {
|
||||||
mEdgeSetFlag |= PADDING;
|
mEdgeSetFlag |= PADDING;
|
||||||
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
||||||
@Override
|
|
||||||
public float getBorder(YogaEdge edge) {
|
public float getBorder(YogaEdge edge) {
|
||||||
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
if (!((mEdgeSetFlag & BORDER) == BORDER)) {
|
||||||
return YogaConstants.UNDEFINED;
|
return YogaConstants.UNDEFINED;
|
||||||
@@ -457,14 +408,12 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
private native void jni_YGNodeStyleSetBorder(long nativePointer, int edge, float border);
|
||||||
@Override
|
|
||||||
public void setBorder(YogaEdge edge, float border) {
|
public void setBorder(YogaEdge edge, float border) {
|
||||||
mEdgeSetFlag |= BORDER;
|
mEdgeSetFlag |= BORDER;
|
||||||
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||||
@Override
|
|
||||||
public YogaValue getPosition(YogaEdge edge) {
|
public YogaValue getPosition(YogaEdge edge) {
|
||||||
if (!mHasSetPosition) {
|
if (!mHasSetPosition) {
|
||||||
return YogaValue.UNDEFINED;
|
return YogaValue.UNDEFINED;
|
||||||
@@ -473,135 +422,113 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||||
@Override
|
|
||||||
public void setPosition(YogaEdge edge, float position) {
|
public void setPosition(YogaEdge edge, float position) {
|
||||||
mHasSetPosition = true;
|
mHasSetPosition = true;
|
||||||
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
||||||
@Override
|
|
||||||
public void setPositionPercent(YogaEdge edge, float percent) {
|
public void setPositionPercent(YogaEdge edge, float percent) {
|
||||||
mHasSetPosition = true;
|
mHasSetPosition = true;
|
||||||
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getWidth() {
|
public YogaValue getWidth() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
||||||
@Override
|
|
||||||
public void setWidth(float width) {
|
public void setWidth(float width) {
|
||||||
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setWidthPercent(float percent) {
|
public void setWidthPercent(float percent) {
|
||||||
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
private native void jni_YGNodeStyleSetWidthAuto(long nativePointer);
|
||||||
@Override
|
|
||||||
public void setWidthAuto() {
|
public void setWidthAuto() {
|
||||||
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
jni_YGNodeStyleSetWidthAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getHeight() {
|
public YogaValue getHeight() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
||||||
@Override
|
|
||||||
public void setHeight(float height) {
|
public void setHeight(float height) {
|
||||||
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setHeightPercent(float percent) {
|
public void setHeightPercent(float percent) {
|
||||||
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
private native void jni_YGNodeStyleSetHeightAuto(long nativePointer);
|
||||||
@Override
|
|
||||||
public void setHeightAuto() {
|
public void setHeightAuto() {
|
||||||
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
jni_YGNodeStyleSetHeightAuto(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getMinWidth() {
|
public YogaValue getMinWidth() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||||
@Override
|
|
||||||
public void setMinWidth(float minWidth) {
|
public void setMinWidth(float minWidth) {
|
||||||
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setMinWidthPercent(float percent) {
|
public void setMinWidthPercent(float percent) {
|
||||||
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getMinHeight() {
|
public YogaValue getMinHeight() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||||
@Override
|
|
||||||
public void setMinHeight(float minHeight) {
|
public void setMinHeight(float minHeight) {
|
||||||
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setMinHeightPercent(float percent) {
|
public void setMinHeightPercent(float percent) {
|
||||||
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getMaxWidth() {
|
public YogaValue getMaxWidth() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||||
@Override
|
|
||||||
public void setMaxWidth(float maxWidth) {
|
public void setMaxWidth(float maxWidth) {
|
||||||
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setMaxWidthPercent(float percent) {
|
public void setMaxWidthPercent(float percent) {
|
||||||
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||||
@Override
|
|
||||||
public YogaValue getMaxHeight() {
|
public YogaValue getMaxHeight() {
|
||||||
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||||
@Override
|
|
||||||
public void setMaxHeight(float maxheight) {
|
public void setMaxHeight(float maxheight) {
|
||||||
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
||||||
@Override
|
|
||||||
public void setMaxHeightPercent(float percent) {
|
public void setMaxHeightPercent(float percent) {
|
||||||
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
@@ -616,27 +543,22 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
jni_YGNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutX() {
|
public float getLayoutX() {
|
||||||
return mLeft;
|
return mLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutY() {
|
public float getLayoutY() {
|
||||||
return mTop;
|
return mTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutWidth() {
|
public float getLayoutWidth() {
|
||||||
return mWidth;
|
return mWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutHeight() {
|
public float getLayoutHeight() {
|
||||||
return mHeight;
|
return mHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutMargin(YogaEdge edge) {
|
public float getLayoutMargin(YogaEdge edge) {
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
@@ -656,7 +578,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutPadding(YogaEdge edge) {
|
public float getLayoutPadding(YogaEdge edge) {
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
@@ -676,7 +597,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getLayoutBorder(YogaEdge edge) {
|
public float getLayoutBorder(YogaEdge edge) {
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
@@ -696,13 +616,11 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public YogaDirection getLayoutDirection() {
|
public YogaDirection getLayoutDirection() {
|
||||||
return YogaDirection.fromInt(mLayoutDirection);
|
return YogaDirection.fromInt(mLayoutDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
@Override
|
|
||||||
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
|
||||||
mMeasureFunction = measureFunction;
|
mMeasureFunction = measureFunction;
|
||||||
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
jni_YGNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
|
||||||
@@ -728,7 +646,6 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
@Override
|
|
||||||
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
public void setBaselineFunction(YogaBaselineFunction baselineFunction) {
|
||||||
mBaselineFunction = baselineFunction;
|
mBaselineFunction = baselineFunction;
|
||||||
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
jni_YGNodeSetHasBaselineFunc(mNativePointer, baselineFunction != null);
|
||||||
@@ -739,17 +656,14 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
return mBaselineFunction.baseline(this, width, height);
|
return mBaselineFunction.baseline(this, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMeasureDefined() {
|
public boolean isMeasureDefined() {
|
||||||
return mMeasureFunction != null;
|
return mMeasureFunction != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setData(Object data) {
|
public void setData(Object data) {
|
||||||
mData = data;
|
mData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getData() {
|
public Object getData() {
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
@@ -1,100 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga;
|
|
||||||
|
|
||||||
// This only exists for legacy reasons. It will be removed sometime in the near future.
|
|
||||||
public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
|
||||||
int getChildCount();
|
|
||||||
YogaNodeType getChildAt(int i);
|
|
||||||
void addChildAt(YogaNodeType child, int i);
|
|
||||||
YogaNodeType removeChildAt(int i);
|
|
||||||
YogaNodeType getParent();
|
|
||||||
int indexOf(YogaNodeType child);
|
|
||||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
|
||||||
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
|
||||||
boolean isMeasureDefined();
|
|
||||||
void calculateLayout(float width, float height);
|
|
||||||
boolean isDirty();
|
|
||||||
boolean hasNewLayout();
|
|
||||||
void dirty();
|
|
||||||
void markLayoutSeen();
|
|
||||||
void copyStyle(YogaNodeType srcNode);
|
|
||||||
YogaDirection getStyleDirection();
|
|
||||||
void setDirection(YogaDirection direction);
|
|
||||||
YogaFlexDirection getFlexDirection();
|
|
||||||
void setFlexDirection(YogaFlexDirection flexDirection);
|
|
||||||
YogaJustify getJustifyContent();
|
|
||||||
void setJustifyContent(YogaJustify justifyContent);
|
|
||||||
YogaAlign getAlignItems();
|
|
||||||
void setAlignItems(YogaAlign alignItems);
|
|
||||||
YogaAlign getAlignSelf();
|
|
||||||
void setAlignSelf(YogaAlign alignSelf);
|
|
||||||
YogaAlign getAlignContent();
|
|
||||||
void setAlignContent(YogaAlign alignContent);
|
|
||||||
YogaPositionType getPositionType();
|
|
||||||
void setPositionType(YogaPositionType positionType);
|
|
||||||
void setWrap(YogaWrap flexWrap);
|
|
||||||
void setFlex(float flex);
|
|
||||||
float getFlexGrow();
|
|
||||||
void setFlexGrow(float flexGrow);
|
|
||||||
float getFlexShrink();
|
|
||||||
void setFlexShrink(float flexShrink);
|
|
||||||
YogaValue getFlexBasis();
|
|
||||||
void setFlexBasis(float flexBasis);
|
|
||||||
void setFlexBasisPercent(float percent);
|
|
||||||
void setFlexBasisAuto();
|
|
||||||
YogaValue getMargin(YogaEdge edge);
|
|
||||||
void setMargin(YogaEdge edge, float margin);
|
|
||||||
void setMarginPercent(YogaEdge edge, float percent);
|
|
||||||
void setMarginAuto(YogaEdge edge);
|
|
||||||
YogaValue getPadding(YogaEdge edge);
|
|
||||||
void setPadding(YogaEdge edge, float padding);
|
|
||||||
void setPaddingPercent(YogaEdge edge, float percent);
|
|
||||||
float getBorder(YogaEdge edge);
|
|
||||||
void setBorder(YogaEdge edge, float border);
|
|
||||||
YogaValue getPosition(YogaEdge edge);
|
|
||||||
void setPosition(YogaEdge edge, float position);
|
|
||||||
void setPositionPercent(YogaEdge edge, float percent);
|
|
||||||
YogaValue getWidth();
|
|
||||||
void setWidth(float width);
|
|
||||||
void setWidthPercent(float percent);
|
|
||||||
void setWidthAuto();
|
|
||||||
YogaValue getHeight();
|
|
||||||
void setHeight(float height);
|
|
||||||
void setHeightPercent(float percent);
|
|
||||||
void setHeightAuto();
|
|
||||||
YogaValue getMaxWidth();
|
|
||||||
void setMaxWidth(float maxWidth);
|
|
||||||
void setMaxWidthPercent(float percent);
|
|
||||||
YogaValue getMinWidth();
|
|
||||||
void setMinWidth(float minWidth);
|
|
||||||
void setMinWidthPercent(float percent);
|
|
||||||
YogaValue getMaxHeight();
|
|
||||||
void setMaxHeight(float maxHeight);
|
|
||||||
void setMaxHeightPercent(float percent);
|
|
||||||
YogaValue getMinHeight();
|
|
||||||
void setMinHeight(float minHeight);
|
|
||||||
void setMinHeightPercent(float percent);
|
|
||||||
float getLayoutX();
|
|
||||||
float getLayoutY();
|
|
||||||
float getLayoutWidth();
|
|
||||||
float getLayoutHeight();
|
|
||||||
float getLayoutMargin(YogaEdge edge);
|
|
||||||
float getLayoutPadding(YogaEdge edge);
|
|
||||||
float getLayoutBorder(YogaEdge edge);
|
|
||||||
YogaDirection getLayoutDirection();
|
|
||||||
YogaOverflow getOverflow();
|
|
||||||
void setOverflow(YogaOverflow overflow);
|
|
||||||
YogaDisplay getDisplay();
|
|
||||||
void setDisplay(YogaDisplay display);
|
|
||||||
void setData(Object data);
|
|
||||||
Object getData();
|
|
||||||
void reset();
|
|
||||||
}
|
|
@@ -465,6 +465,97 @@ public class YGMinMaxDimensionTest {
|
|||||||
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_grow_child() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root_child0.setFlexBasis(0f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_grow_within_constrained_min_max_column() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setMinHeight(100f);
|
||||||
|
root.setMaxHeight(200f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.setHeight(50f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_flex_grow_within_max_width() {
|
public void test_flex_grow_within_max_width() {
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
@@ -936,111 +1027,4 @@ public class YGMinMaxDimensionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test_min_width_in_flex_distribution() {
|
|
||||||
YogaConfig config = new YogaConfig();
|
|
||||||
|
|
||||||
final YogaNode root = new YogaNode(config);
|
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
|
||||||
root.setWidth(300f);
|
|
||||||
root.setHeight(300f);
|
|
||||||
|
|
||||||
final YogaNode root_child0 = new YogaNode(config);
|
|
||||||
root_child0.setFlexGrow(2f);
|
|
||||||
root_child0.setFlexShrink(1f);
|
|
||||||
root_child0.setFlexBasisPercent(0f);
|
|
||||||
root_child0.setMinWidth(100f);
|
|
||||||
root_child0.setMaxWidth(200f);
|
|
||||||
root.addChildAt(root_child0, 0);
|
|
||||||
|
|
||||||
final YogaNode root_child1 = new YogaNode(config);
|
|
||||||
root_child1.setFlexGrow(1f);
|
|
||||||
root_child1.setFlexShrink(1f);
|
|
||||||
root_child1.setFlexBasisPercent(0f);
|
|
||||||
root.addChildAt(root_child1, 1);
|
|
||||||
|
|
||||||
final YogaNode root_child2 = new YogaNode(config);
|
|
||||||
root_child2.setFlexGrow(1f);
|
|
||||||
root_child2.setFlexShrink(1f);
|
|
||||||
root_child2.setFlexBasisPercent(0f);
|
|
||||||
root.addChildAt(root_child2, 2);
|
|
||||||
|
|
||||||
final YogaNode root_child3 = new YogaNode(config);
|
|
||||||
root_child3.setFlexGrow(1f);
|
|
||||||
root_child3.setFlexShrink(1f);
|
|
||||||
root_child3.setFlexBasisPercent(0f);
|
|
||||||
root.addChildAt(root_child3, 3);
|
|
||||||
|
|
||||||
final YogaNode root_child4 = new YogaNode(config);
|
|
||||||
root_child4.setFlexGrow(1f);
|
|
||||||
root_child4.setFlexShrink(1f);
|
|
||||||
root_child4.setFlexBasisPercent(0f);
|
|
||||||
root.addChildAt(root_child4, 4);
|
|
||||||
root.setDirection(YogaDirection.LTR);
|
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(100f, root_child1.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(150f, root_child2.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(200f, root_child3.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child3.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(250f, root_child4.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child4.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(200f, root_child0.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(100f, root_child2.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(50f, root_child3.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child3.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child3.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child3.getLayoutHeight(), 0.0f);
|
|
||||||
|
|
||||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
|
||||||
assertEquals(0f, root_child4.getLayoutY(), 0.0f);
|
|
||||||
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
|
|
||||||
assertEquals(300f, root_child4.getLayoutHeight(), 0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -674,17 +674,17 @@ public class YGRoundingTest {
|
|||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
@@ -697,17 +697,17 @@ public class YGRoundingTest {
|
|||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(64f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(64f, root_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(89f, root_child2.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -782,4 +782,304 @@ public class YGRoundingTest {
|
|||||||
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_rounding_inner_node_controversy_horizontal() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(320f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root_child0.setHeight(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setHeight(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.setFlexGrow(1f);
|
||||||
|
root_child1_child0.setHeight(10f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.setFlexGrow(1f);
|
||||||
|
root_child2.setHeight(10f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(107f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(107f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(213f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(107f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(213f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(107f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(107f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(107f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_rounding_inner_node_controversy_vertical() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setHeight(320f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.setFlexGrow(1f);
|
||||||
|
root_child1_child0.setWidth(10f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.setFlexGrow(1f);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_rounding_inner_node_controversy_combined() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(640f);
|
||||||
|
root.setHeight(320f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root_child0.setHeightPercent(100f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode(config);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setHeightPercent(100f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child0.setFlexGrow(1f);
|
||||||
|
root_child1_child0.setWidthPercent(100f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child1 = new YogaNode(config);
|
||||||
|
root_child1_child1.setFlexGrow(1f);
|
||||||
|
root_child1_child1.setWidthPercent(100f);
|
||||||
|
root_child1.addChildAt(root_child1_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child1_child0 = new YogaNode(config);
|
||||||
|
root_child1_child1_child0.setFlexGrow(1f);
|
||||||
|
root_child1_child1_child0.setWidthPercent(100f);
|
||||||
|
root_child1_child1.addChildAt(root_child1_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child2 = new YogaNode(config);
|
||||||
|
root_child1_child2.setFlexGrow(1f);
|
||||||
|
root_child1_child2.setWidthPercent(100f);
|
||||||
|
root_child1.addChildAt(root_child1_child2, 2);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = new YogaNode(config);
|
||||||
|
root_child2.setFlexGrow(1f);
|
||||||
|
root_child2.setHeightPercent(100f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(640f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(213f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(213f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(213f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(427f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(213f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(640f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(427f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(213f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(213f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(106f, root_child1_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(213f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(214f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(107f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(213f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(320f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ public class YogaNodeTest {
|
|||||||
child2.setWidth(40);
|
child2.setWidth(40);
|
||||||
child2.setHeight(40);
|
child2.setHeight(40);
|
||||||
child2.setBaselineFunction(new YogaBaselineFunction() {
|
child2.setBaselineFunction(new YogaBaselineFunction() {
|
||||||
public float baseline(YogaNodeAPI node, float width, float height) {
|
public float baseline(YogaNode node, float width, float height) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -57,7 +57,7 @@ public class YogaNodeTest {
|
|||||||
final YogaNode node = new YogaNode();
|
final YogaNode node = new YogaNode();
|
||||||
node.setMeasureFunction(new YogaMeasureFunction() {
|
node.setMeasureFunction(new YogaMeasureFunction() {
|
||||||
public long measure(
|
public long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
@@ -75,7 +75,7 @@ public class YogaNodeTest {
|
|||||||
final YogaNode node = new YogaNode();
|
final YogaNode node = new YogaNode();
|
||||||
node.setMeasureFunction(new YogaMeasureFunction() {
|
node.setMeasureFunction(new YogaMeasureFunction() {
|
||||||
public long measure(
|
public long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
@@ -93,7 +93,7 @@ public class YogaNodeTest {
|
|||||||
final YogaNode node = new YogaNode();
|
final YogaNode node = new YogaNode();
|
||||||
node.setMeasureFunction(new YogaMeasureFunction() {
|
node.setMeasureFunction(new YogaMeasureFunction() {
|
||||||
public long measure(
|
public long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
@@ -111,7 +111,7 @@ public class YogaNodeTest {
|
|||||||
final YogaNode node = new YogaNode();
|
final YogaNode node = new YogaNode();
|
||||||
node.setMeasureFunction(new YogaMeasureFunction() {
|
node.setMeasureFunction(new YogaMeasureFunction() {
|
||||||
public long measure(
|
public long measure(
|
||||||
YogaNodeAPI node,
|
YogaNode node,
|
||||||
float width,
|
float width,
|
||||||
YogaMeasureMode widthMode,
|
YogaMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
|
@@ -498,6 +498,105 @@ it("flex_grow_in_at_most_container", function () {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
it("flex_grow_child", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexGrow(1);
|
||||||
|
root_child0.setFlexBasis(0);
|
||||||
|
root_child0.setHeight(100);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it("flex_grow_within_constrained_min_max_column", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setMinHeight(100);
|
||||||
|
root.setMaxHeight(200);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexGrow(1);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setHeight(50);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
it("flex_grow_within_max_width", function () {
|
it("flex_grow_within_max_width", function () {
|
||||||
var config = Yoga.Config.create();
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
@@ -1013,114 +1112,3 @@ it("min_max_percent_no_width_height", function () {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it("min_width_in_flex_distribution", function () {
|
|
||||||
var config = Yoga.Config.create();
|
|
||||||
|
|
||||||
try {
|
|
||||||
var root = Yoga.Node.create(config);
|
|
||||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
|
||||||
root.setWidth(300);
|
|
||||||
root.setHeight(300);
|
|
||||||
|
|
||||||
var root_child0 = Yoga.Node.create(config);
|
|
||||||
root_child0.setFlexGrow(2);
|
|
||||||
root_child0.setFlexShrink(1);
|
|
||||||
root_child0.setFlexBasis("0%");
|
|
||||||
root_child0.setMinWidth(100);
|
|
||||||
root_child0.setMaxWidth(200);
|
|
||||||
root.insertChild(root_child0, 0);
|
|
||||||
|
|
||||||
var root_child1 = Yoga.Node.create(config);
|
|
||||||
root_child1.setFlexGrow(1);
|
|
||||||
root_child1.setFlexShrink(1);
|
|
||||||
root_child1.setFlexBasis("0%");
|
|
||||||
root.insertChild(root_child1, 1);
|
|
||||||
|
|
||||||
var root_child2 = Yoga.Node.create(config);
|
|
||||||
root_child2.setFlexGrow(1);
|
|
||||||
root_child2.setFlexShrink(1);
|
|
||||||
root_child2.setFlexBasis("0%");
|
|
||||||
root.insertChild(root_child2, 2);
|
|
||||||
|
|
||||||
var root_child3 = Yoga.Node.create(config);
|
|
||||||
root_child3.setFlexGrow(1);
|
|
||||||
root_child3.setFlexShrink(1);
|
|
||||||
root_child3.setFlexBasis("0%");
|
|
||||||
root.insertChild(root_child3, 3);
|
|
||||||
|
|
||||||
var root_child4 = Yoga.Node.create(config);
|
|
||||||
root_child4.setFlexGrow(1);
|
|
||||||
root_child4.setFlexShrink(1);
|
|
||||||
root_child4.setFlexBasis("0%");
|
|
||||||
root.insertChild(root_child4, 4);
|
|
||||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
||||||
|
|
||||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
||||||
console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
||||||
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child0.getComputedHeight(), "300 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child1.getComputedHeight(), "300 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(150 === root_child2.getComputedLeft(), "150 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child2.getComputedHeight(), "300 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(200 === root_child3.getComputedLeft(), "200 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child3.getComputedHeight(), "300 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(250 === root_child4.getComputedLeft(), "250 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child4.getComputedHeight(), "300 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
||||||
|
|
||||||
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
||||||
console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(200 === root_child0.getComputedLeft(), "200 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
||||||
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child0.getComputedHeight(), "300 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child1.getComputedHeight(), "300 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child2.getComputedHeight(), "300 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child3.getComputedHeight(), "300 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
|
||||||
|
|
||||||
console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");
|
|
||||||
console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");
|
|
||||||
console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");
|
|
||||||
console.assert(300 === root_child4.getComputedHeight(), "300 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");
|
|
||||||
} finally {
|
|
||||||
if (typeof root !== "undefined") {
|
|
||||||
root.freeRecursive();
|
|
||||||
}
|
|
||||||
|
|
||||||
config.free();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
@@ -709,17 +709,17 @@ it("rounding_fractial_input_3", function () {
|
|||||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
@@ -731,17 +731,17 @@ it("rounding_fractial_input_3", function () {
|
|||||||
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== "undefined") {
|
if (typeof root !== "undefined") {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -827,3 +827,318 @@ it("rounding_fractial_input_4", function () {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
it("rounding_inner_node_controversy_horizontal", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||||
|
root.setWidth(320);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexGrow(1);
|
||||||
|
root_child0.setHeight(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setHeight(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
var root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setFlexGrow(1);
|
||||||
|
root_child1_child0.setHeight(10);
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
var root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setFlexGrow(1);
|
||||||
|
root_child2.setHeight(10);
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(213 === root_child2.getComputedLeft(), "213 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(213 === root_child0.getComputedLeft(), "213 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it("rounding_inner_node_controversy_vertical", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setHeight(320);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexGrow(1);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
var root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setFlexGrow(1);
|
||||||
|
root_child1_child0.setWidth(10);
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
var root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setFlexGrow(1);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it("rounding_inner_node_controversy_combined", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||||
|
root.setWidth(640);
|
||||||
|
root.setHeight(320);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexGrow(1);
|
||||||
|
root_child0.setHeight("100%");
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setHeight("100%");
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
var root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setFlexGrow(1);
|
||||||
|
root_child1_child0.setWidth("100%");
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
var root_child1_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1_child1.setFlexGrow(1);
|
||||||
|
root_child1_child1.setWidth("100%");
|
||||||
|
root_child1.insertChild(root_child1_child1, 1);
|
||||||
|
|
||||||
|
var root_child1_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child1_child0.setFlexGrow(1);
|
||||||
|
root_child1_child1_child0.setWidth("100%");
|
||||||
|
root_child1_child1.insertChild(root_child1_child1_child0, 0);
|
||||||
|
|
||||||
|
var root_child1_child2 = Yoga.Node.create(config);
|
||||||
|
root_child1_child2.setFlexGrow(1);
|
||||||
|
root_child1_child2.setWidth("100%");
|
||||||
|
root_child1.insertChild(root_child1_child2, 2);
|
||||||
|
|
||||||
|
var root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setFlexGrow(1);
|
||||||
|
root_child2.setHeight("100%");
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(427 === root_child2.getComputedLeft(), "427 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(427 === root_child0.getComputedLeft(), "427 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")");
|
||||||
|
console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")");
|
||||||
|
console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
||||||
|
console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
||||||
|
console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -21,7 +21,7 @@ prebuilt_cxx_library(
|
|||||||
|
|
||||||
cxx_library(
|
cxx_library(
|
||||||
name = "fbjni",
|
name = "fbjni",
|
||||||
srcs = glob(["**/*.cpp"]),
|
srcs = glob(["src/main/cpp/**/*.cpp"]),
|
||||||
compiler_flags = [
|
compiler_flags = [
|
||||||
"-DLOG_TAG=\"libfb\"",
|
"-DLOG_TAG=\"libfb\"",
|
||||||
"-DDISABLE_CPUCAP",
|
"-DDISABLE_CPUCAP",
|
||||||
@@ -35,7 +35,7 @@ cxx_library(
|
|||||||
"-Wno-unused-parameter",
|
"-Wno-unused-parameter",
|
||||||
"-std=c++11",
|
"-std=c++11",
|
||||||
],
|
],
|
||||||
exported_headers = subdir_glob([("include", "**/*.h")]),
|
exported_headers = subdir_glob([("src/main/cpp/include", "**/*.h")]),
|
||||||
header_namespace = "",
|
header_namespace = "",
|
||||||
visibility = ["PUBLIC"],
|
visibility = ["PUBLIC"],
|
||||||
deps = [
|
deps = [
|
||||||
|
27
lib/fb/build.gradle
Normal file
27
lib/fb/build.gradle
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion rootProject.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.targetSdkVersion
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path 'src/main/cpp/CMakeLists.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
lib/fb/src/main/AndroidManifest.xml
Normal file
14
lib/fb/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
This source code is licensed under the BSD-style license found in the
|
||||||
|
LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.facebook.libfb">
|
||||||
|
</manifest>
|
33
lib/fb/src/main/cpp/CMakeLists.txt
Normal file
33
lib/fb/src/main/cpp/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2014-present, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.4.1)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
|
add_compile_options(
|
||||||
|
-fno-omit-frame-pointer
|
||||||
|
-fexceptions
|
||||||
|
-Wall
|
||||||
|
-std=c++11
|
||||||
|
-DDISABLE_CPUCAP
|
||||||
|
-DDISABLE_XPLAT)
|
||||||
|
|
||||||
|
file(GLOB fb_SRC
|
||||||
|
*.cpp
|
||||||
|
jni/*.cpp
|
||||||
|
lyra/*.cpp)
|
||||||
|
|
||||||
|
add_library(fb SHARED
|
||||||
|
${fb_SRC})
|
||||||
|
|
||||||
|
target_include_directories(fb PRIVATE
|
||||||
|
include)
|
||||||
|
|
||||||
|
target_link_libraries(fb android log)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user