Compare commits
45 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b5c2b09780 | ||
|
46817a38c3 | ||
|
52f3471405 | ||
|
e567502750 | ||
|
c1cdc1de58 | ||
|
f2c41f366f | ||
|
56d06e27cf | ||
|
93e327f4a5 | ||
|
687668a4b3 | ||
|
cfeac79130 | ||
|
4227e36ca5 | ||
|
be1c9f249e | ||
|
511a129a7e | ||
|
d62ca8c518 | ||
|
30413265c7 | ||
|
bd5d8a77c9 | ||
|
326ae15532 | ||
|
9afb65da34 | ||
|
fe7643c84a | ||
|
6daad3ae66 | ||
|
44590b8907 | ||
|
4400b52aab | ||
|
c217553cf8 | ||
|
6ad5003149 | ||
|
7c77b0e48c | ||
|
7b36118df4 | ||
|
7f0dbe5356 | ||
|
b87fc217df | ||
|
625dc4bf44 | ||
|
34736a4929 | ||
|
4f37cde043 | ||
|
7df60376ff | ||
|
7fa4adb0d9 | ||
|
abb91ae77b | ||
|
a4b1ac83f4 | ||
|
8775cdc13f | ||
|
db732ce9fa | ||
|
7c09244c39 | ||
|
2cc2a5f2ff | ||
|
e4b50f2a8d | ||
|
a2a84532ff | ||
|
d391323129 | ||
|
ab28ecf31b | ||
|
a4bab68802 | ||
|
e3cfacf0cb |
17
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Report
|
||||||
|
|
||||||
|
- [ ] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate
|
||||||
|
|
||||||
|
# Issues and Steps to Reproduce
|
||||||
|
***Replaces this with steps to repro your issue.***
|
||||||
|
|
||||||
|
# Expected Behavior
|
||||||
|
***Describe what you expected would happen.***
|
||||||
|
|
||||||
|
# Actual Behavior
|
||||||
|
***Describe what actually happened.***
|
||||||
|
|
||||||
|
# Link to Code
|
||||||
|
***If you have some code that maintainers can clone/test for themselves, bugs can be resolved much faster. Please paste a link here.***
|
||||||
|
|
||||||
|
***When applicable, use this [fiddle](https://jsfiddle.net/emilsjolander/jckmwztt/) to post a web repro.***
|
1
.swift-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0
|
@@ -6,7 +6,7 @@
|
|||||||
# of patent rights can be found in the PATENTS file in the same directory.
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
os: osx
|
os: osx
|
||||||
osx_image: xcode7.3
|
osx_image: xcode8.2
|
||||||
language: cpp
|
language: cpp
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ install:
|
|||||||
script:
|
script:
|
||||||
- buck test //:yoga
|
- buck test //:yoga
|
||||||
- buck test //java:java
|
- buck test //java:java
|
||||||
- buck test //YogaKit:YogaKitTests --config cxx.default_platform=iphonesimulator-x86_64 --config cxx.cflags=-DTRAVIS_CI
|
- buck test //YogaKit:YogaKitTests --config cxx.default_platform=iphonesimulator-x86_64
|
||||||
- sh csharp/tests/Facebook.Yoga/test_macos.sh
|
- sh csharp/tests/Facebook.Yoga/test_macos.sh
|
||||||
|
|
||||||
- cd javascript
|
- cd javascript
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Yoga [](https://travis-ci.org/facebook/yoga)
|
# Yoga [](https://travis-ci.org/facebook/yoga) [](http://cocoapods.org/pods/YogaKit) [](https://www.npmjs.com/package/yoga-layout)
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
|
Yoga builds with [buck](https://buckbuild.com). Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.
|
||||||
|
28
Yoga.podspec
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Pod::Spec.new do |spec|
|
||||||
|
spec.name = 'Yoga'
|
||||||
|
spec.version = '1.0.2'
|
||||||
|
spec.license = { :type => 'BSD', :file => "LICENSE" }
|
||||||
|
spec.homepage = 'https://facebook.github.io/yoga/'
|
||||||
|
spec.documentation_url = 'https://facebook.github.io/yoga/docs/api/c/'
|
||||||
|
|
||||||
|
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.'
|
||||||
|
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.'
|
||||||
|
|
||||||
|
spec.authors = 'Facebook'
|
||||||
|
spec.source = {
|
||||||
|
:git => 'https://github.com/facebook/yoga.git',
|
||||||
|
:tag => 'v2017.01.27.00',
|
||||||
|
}
|
||||||
|
|
||||||
|
spec.module_name = 'yoga'
|
||||||
|
spec.requires_arc = false
|
||||||
|
spec.compiler_flags = [
|
||||||
|
'-fno-omit-frame-pointer',
|
||||||
|
'-fexceptions',
|
||||||
|
'-Wall',
|
||||||
|
'-Werror',
|
||||||
|
'-std=c11',
|
||||||
|
'-fPIC'
|
||||||
|
]
|
||||||
|
spec.source_files = 'yoga/**/*.{c,h}'
|
||||||
|
end
|
29
YogaKit.podspec
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
podspec = Pod::Spec.new do |spec|
|
||||||
|
spec.name = 'YogaKit'
|
||||||
|
spec.version = '1.0.3'
|
||||||
|
spec.license = { :type => 'BSD', :file => "LICENSE" }
|
||||||
|
spec.homepage = 'https://facebook.github.io/yoga/'
|
||||||
|
spec.documentation_url = 'https://facebook.github.io/yoga/docs/api/yogakit/'
|
||||||
|
|
||||||
|
spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.'
|
||||||
|
spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.'
|
||||||
|
|
||||||
|
spec.authors = 'Facebook'
|
||||||
|
spec.source = {
|
||||||
|
:git => 'https://github.com/facebook/yoga.git',
|
||||||
|
:tag => 'v2017.01.27.00',
|
||||||
|
}
|
||||||
|
|
||||||
|
spec.platform = :ios
|
||||||
|
spec.ios.deployment_target = '8.0'
|
||||||
|
spec.ios.frameworks = 'UIKit'
|
||||||
|
|
||||||
|
spec.dependency 'Yoga', '~> 1.0'
|
||||||
|
spec.source_files = 'YogaKit/Source/*.{h,m}'
|
||||||
|
spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h'
|
||||||
|
spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h'
|
||||||
|
end
|
||||||
|
|
||||||
|
# See https://github.com/facebook/yoga/pull/366
|
||||||
|
podspec.attributes_hash["readme"] = "YogaKit/README.md"
|
||||||
|
podspec
|
1
YogaKit/.swift-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0.2
|
@@ -30,8 +30,8 @@ COMPILER_FLAGS = [
|
|||||||
apple_library(
|
apple_library(
|
||||||
name = 'YogaKit',
|
name = 'YogaKit',
|
||||||
compiler_flags = COMPILER_FLAGS,
|
compiler_flags = COMPILER_FLAGS,
|
||||||
srcs = glob(['*.m']),
|
srcs = glob(['Source/**/*.m']),
|
||||||
exported_headers = glob(['*.h']),
|
exported_headers = glob(['Source/**/*.h']),
|
||||||
frameworks = [
|
frameworks = [
|
||||||
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
|
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
|
||||||
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
|
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
|
||||||
|
22
YogaKit/README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# YogaKit
|
||||||
|
|
||||||
|
[](https://cocoapods.org/pods/YogaKit)
|
||||||
|
[](https://facebook.github.io/yoga/docs/api/yogakit/)
|
||||||
|
[](https://facebook.github.io/yoga/docs/api/yogakit/)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
YogaKit is available to install via [CocoaPods](https://cocoapods.org/).
|
||||||
|
|
||||||
|
```
|
||||||
|
pod 'YogaKit', '~> 1.0.2'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
Checkout the docs [here](https://facebook.github.io/yoga/docs/api/yogakit/).
|
||||||
|
|
||||||
|
We also have a sample project. To try it out, clone this repo and open `YogaKitSample.xcodeproj` in the [YogaKitSample](https://github.com/facebook/yoga/tree/master/YogaKit/YogaKitSample) directory.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
We welcome all pull-requests! At Facebook we sync the open source version of `YogaKit` daily, so we're always testing the latest changes.
|
||||||
|
|
||||||
|
See the [CONTRIBUTING](https://github.com/facebook/yoga/blob/master/CONTRIBUTING) file for how to help out.
|
@@ -7,8 +7,8 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import "YGLayout.h"
|
#import "YGLayout.h"
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface UIView (Yoga)
|
@interface UIView (Yoga)
|
||||||
|
|
@@ -18,7 +18,8 @@
|
|||||||
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
|
@property (nonatomic, readwrite, assign, setter=setIncludedInLayout:) BOOL isIncludedInLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The property that decides during layout/sizing whether or not styling properties should be applied. Defaults to NO.
|
The property that decides during layout/sizing whether or not styling properties should be applied.
|
||||||
|
Defaults to NO.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readwrite, assign, setter=setEnabled:) BOOL isEnabled;
|
@property (nonatomic, readwrite, assign, setter=setEnabled:) BOOL isEnabled;
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
@property (nonatomic, readwrite, assign) YGPositionType position;
|
@property (nonatomic, readwrite, assign) YGPositionType position;
|
||||||
@property (nonatomic, readwrite, assign) YGWrap flexWrap;
|
@property (nonatomic, readwrite, assign) YGWrap flexWrap;
|
||||||
@property (nonatomic, readwrite, assign) YGOverflow overflow;
|
@property (nonatomic, readwrite, assign) YGOverflow overflow;
|
||||||
|
@property (nonatomic, readwrite, assign) YGDisplay display;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, assign) CGFloat flexGrow;
|
@property (nonatomic, readwrite, assign) CGFloat flexGrow;
|
||||||
@property (nonatomic, readwrite, assign) CGFloat flexShrink;
|
@property (nonatomic, readwrite, assign) CGFloat flexShrink;
|
||||||
@@ -84,7 +86,7 @@
|
|||||||
/**
|
/**
|
||||||
Get the resolved direction of this node. This won't be YGDirectionInherit
|
Get the resolved direction of this node. This won't be YGDirectionInherit
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, assign) YGDirection resolvedDirection;
|
@property (nonatomic, readonly, assign) YGDirection resolvedDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform a layout calculation and update the frames of the views in the hierarchy with the results
|
Perform a layout calculation and update the frames of the views in the hierarchy with the results
|
||||||
@@ -92,19 +94,21 @@
|
|||||||
- (void)applyLayout NS_SWIFT_NAME(applyLayout());
|
- (void)applyLayout NS_SWIFT_NAME(applyLayout());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
Returns the size of the view if no constraints were given. This could equivalent to calling [self
|
||||||
|
sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, assign) CGSize intrinsicSize;
|
@property (nonatomic, readonly, assign) CGSize intrinsicSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the number of children that are using Flexbox.
|
Returns the number of children that are using Flexbox.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, assign) NSUInteger numberOfChildren;
|
@property (nonatomic, readonly, assign) NSUInteger numberOfChildren;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return a BOOL indiciating whether or not we this node contains any subviews that are included in Yoga's layout.
|
Return a BOOL indiciating whether or not we this node contains any subviews that are included in
|
||||||
|
Yoga's layout.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, assign) BOOL isLeaf;
|
@property (nonatomic, readonly, assign) BOOL isLeaf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Mark that a view's layout needs to be recalculated. Only works for leaf views.
|
Mark that a view's layout needs to be recalculated. Only works for leaf views.
|
@@ -181,6 +181,7 @@ YG_PROPERTY(YGAlign, alignItems, AlignItems)
|
|||||||
YG_PROPERTY(YGAlign, alignSelf, AlignSelf)
|
YG_PROPERTY(YGAlign, alignSelf, AlignSelf)
|
||||||
YG_PROPERTY(YGWrap, flexWrap, FlexWrap)
|
YG_PROPERTY(YGWrap, flexWrap, FlexWrap)
|
||||||
YG_PROPERTY(YGOverflow, overflow, Overflow)
|
YG_PROPERTY(YGOverflow, overflow, Overflow)
|
||||||
|
YG_PROPERTY(YGDisplay, display, Display)
|
||||||
|
|
||||||
YG_PROPERTY(CGFloat, flexGrow, FlexGrow)
|
YG_PROPERTY(CGFloat, flexGrow, FlexGrow)
|
||||||
YG_PROPERTY(CGFloat, flexShrink, FlexShrink)
|
YG_PROPERTY(CGFloat, flexShrink, FlexShrink)
|
@@ -18,40 +18,44 @@
|
|||||||
|
|
||||||
@implementation YogaKitTests
|
@implementation YogaKitTests
|
||||||
|
|
||||||
#ifndef TRAVIS_CI
|
|
||||||
|
|
||||||
- (void)testNodesAreDeallocedWithSingleView
|
- (void)testNodesAreDeallocedWithSingleView
|
||||||
{
|
{
|
||||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
__weak YGLayout *layoutRef = nil;
|
||||||
|
|
||||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
@autoreleasepool {
|
||||||
view.yoga.flexBasis = 1;
|
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
XCTAssertEqual(1, YGNodeGetInstanceCount());
|
view.yoga.flexBasis = 1;
|
||||||
view = nil;
|
|
||||||
|
|
||||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
layoutRef = view.yoga;
|
||||||
|
XCTAssertNotNil(layoutRef);
|
||||||
|
|
||||||
|
view = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
XCTAssertNil(layoutRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testNodesAreDeallocedCascade
|
- (void)testNodesAreDeallocedCascade
|
||||||
{
|
{
|
||||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
__weak YGLayout *topLayout = nil;
|
||||||
|
__weak YGLayout *subviewLayout = nil;
|
||||||
|
|
||||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
@autoreleasepool {
|
||||||
view.yoga.flexBasis = 1;
|
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
|
topLayout = view.yoga;
|
||||||
|
topLayout.flexBasis = 1;
|
||||||
|
|
||||||
for (int i=0; i<10; i++) {
|
|
||||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
subview.yoga.flexBasis = 1;
|
subviewLayout = subview.yoga;
|
||||||
[view addSubview:subview];
|
subviewLayout.flexBasis = 1;
|
||||||
|
|
||||||
|
view = nil;
|
||||||
}
|
}
|
||||||
XCTAssertEqual(11, YGNodeGetInstanceCount());
|
|
||||||
view = nil;
|
|
||||||
|
|
||||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
XCTAssertNil(topLayout);
|
||||||
|
XCTAssertNil(subviewLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- (void)testIsEnabled
|
- (void)testIsEnabled
|
||||||
{
|
{
|
||||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
@@ -89,13 +93,20 @@
|
|||||||
|
|
||||||
UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
textBadgeView.yoga.isEnabled = YES;
|
textBadgeView.yoga.isEnabled = YES;
|
||||||
textBadgeView.yoga.marginLeft = 3.0;
|
textBadgeView.yoga.margin = 0;
|
||||||
textBadgeView.yoga.width = 10;
|
textBadgeView.yoga.width = 10;
|
||||||
textBadgeView.yoga.height = 10;
|
textBadgeView.yoga.height = 10;
|
||||||
[container addSubview:textBadgeView];
|
[container addSubview:textBadgeView];
|
||||||
|
|
||||||
|
const CGSize textBadgeViewSize = textBadgeView.yoga.intrinsicSize;
|
||||||
|
XCTAssertEqual(textBadgeViewSize.height, 10);
|
||||||
|
XCTAssertEqual(textBadgeViewSize.width, 10);
|
||||||
|
|
||||||
const CGSize containerSize = container.yoga.intrinsicSize;
|
const CGSize containerSize = container.yoga.intrinsicSize;
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(514,21), containerSize), @"Size is actually %@", NSStringFromCGSize(containerSize));
|
const CGSize longTextLabelSize = longTextLabel.yoga.intrinsicSize;
|
||||||
|
|
||||||
|
XCTAssertEqual(longTextLabelSize.height, containerSize.height);
|
||||||
|
XCTAssertEqual(longTextLabelSize.width + textBadgeView.yoga.intrinsicSize.width, containerSize.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatMarkingLeafsAsDirtyWillTriggerASizeRecalculation
|
- (void)testThatMarkingLeafsAsDirtyWillTriggerASizeRecalculation
|
||||||
@@ -112,13 +123,15 @@
|
|||||||
[container addSubview:label];
|
[container addSubview:label];
|
||||||
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(146,21), label.bounds.size), @"Size is actually %@", NSStringFromCGSize(label.bounds.size));
|
CGSize const labelSizeAfterFirstPass = label.frame.size;
|
||||||
|
|
||||||
label.text = @"This is a slightly longer text.";
|
label.text = @"This is a slightly longer text.";
|
||||||
|
XCTAssertTrue(CGSizeEqualToSize(label.frame.size, labelSizeAfterFirstPass));
|
||||||
|
|
||||||
[label.yoga markDirty];
|
[label.yoga markDirty];
|
||||||
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(213,21), label.bounds.size), @"Size is actually %@", NSStringFromCGSize(label.bounds.size));
|
XCTAssertFalse(CGSizeEqualToSize(label.frame.size, labelSizeAfterFirstPass));
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testFrameAndOriginPlacement
|
- (void)testFrameAndOriginPlacement
|
||||||
@@ -129,18 +142,25 @@
|
|||||||
container.yoga.isEnabled = YES;
|
container.yoga.isEnabled = YES;
|
||||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
subview1.yoga.isEnabled = YES;
|
||||||
subview.yoga.isEnabled = YES;
|
subview1.yoga.flexGrow = 1;
|
||||||
subview.yoga.flexGrow = 1;
|
[container addSubview:subview1];
|
||||||
|
|
||||||
|
UIView *subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
|
subview2.yoga.isEnabled = YES;
|
||||||
|
subview2.yoga.flexGrow = 1;
|
||||||
|
[container addSubview:subview2];
|
||||||
|
|
||||||
|
UIView *subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
|
subview3.yoga.isEnabled = YES;
|
||||||
|
subview3.yoga.flexGrow = 1;
|
||||||
|
[container addSubview:subview3];
|
||||||
|
|
||||||
[container addSubview:subview];
|
|
||||||
}
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:1].frame));
|
XCTAssertEqualWithAccuracy(subview2.frame.origin.x, CGRectGetMaxX(subview1.frame), FLT_EPSILON);
|
||||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:1].frame, [container.subviews objectAtIndex:2].frame));
|
XCTAssertEqualWithAccuracy(subview3.frame.origin.x, CGRectGetMaxX(subview2.frame), FLT_EPSILON);
|
||||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:2].frame));
|
|
||||||
|
|
||||||
CGFloat totalWidth = 0;
|
CGFloat totalWidth = 0;
|
||||||
for (UIView *view in container.subviews) {
|
for (UIView *view in container.subviews) {
|
||||||
@@ -176,7 +196,7 @@
|
|||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
XCTAssertTrue(CGRectEqualToRect(subview1.frame, CGRectMake(0, 0, 100, 50)));
|
XCTAssertTrue(CGRectEqualToRect(subview1.frame, CGRectMake(0, 0, 100, 50)));
|
||||||
XCTAssertTrue(CGRectEqualToRect(subview2.frame, CGRectMake(100, 0, 100, 50)), @"It's actually %@", NSStringFromCGRect(subview2.frame));
|
XCTAssertTrue(CGRectEqualToRect(subview2.frame, CGRectMake(100, 0, 100, 50)));
|
||||||
XCTAssertTrue(CGRectEqualToRect(subview3.frame, CGRectMake(200, 0, 100, 50)));
|
XCTAssertTrue(CGRectEqualToRect(subview3.frame, CGRectMake(200, 0, 100, 50)));
|
||||||
|
|
||||||
[container exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
|
[container exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
|
||||||
@@ -215,18 +235,18 @@
|
|||||||
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
for (UIView *view in container.subviews) {
|
for (UIView *subview in container.subviews) {
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), view.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
XCTAssertEqual(subview.bounds.size.width, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
subview3.yoga.isIncludedInLayout = NO;
|
subview3.yoga.isIncludedInLayout = NO;
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
XCTAssertEqual(subview1.bounds.size.width, 150);
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
XCTAssertEqual(subview2.bounds.size.width, 150);
|
||||||
|
|
||||||
// We don't set the frame to zero, so, it should be set to what it was previously at.
|
// We don't set the frame to zero, so, it should be set to what it was previously at.
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview3.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview3.bounds.size));
|
XCTAssertEqual(subview3.bounds.size.width, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews
|
- (void)testThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews
|
||||||
@@ -251,11 +271,11 @@
|
|||||||
[container addSubview:subview3];
|
[container addSubview:subview3];
|
||||||
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
XCTAssertEqual(1, container.yoga.numberOfChildren);
|
XCTAssertEqual(container.yoga.numberOfChildren, 1);
|
||||||
|
|
||||||
subview2.yoga.isIncludedInLayout = YES;
|
subview2.yoga.isIncludedInLayout = YES;
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
XCTAssertEqual(2, container.yoga.numberOfChildren);
|
XCTAssertEqual(container.yoga.numberOfChildren, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond
|
- (void)testThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond
|
||||||
@@ -282,18 +302,19 @@
|
|||||||
|
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
XCTAssertEqual(subview1.bounds.size.width, 150);
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
XCTAssertEqual(subview2.bounds.size.width, 150);
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeZero, subview3.bounds.size), @"Actual size %@", NSStringFromCGSize(subview3.bounds.size));
|
XCTAssertEqual(subview3.bounds.size.width, 0);
|
||||||
|
|
||||||
subview3.yoga.isIncludedInLayout = YES;
|
subview3.yoga.isIncludedInLayout = YES;
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
for (UIView *view in container.subviews) {
|
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), view.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
XCTAssertEqual(subview1.bounds.size.width, 100);
|
||||||
}
|
XCTAssertEqual(subview2.bounds.size.width, 100);
|
||||||
|
XCTAssertEqual(subview3.bounds.size.width, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testyg_isLeafFlag
|
- (void)testIsLeafFlag
|
||||||
{
|
{
|
||||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||||
XCTAssertTrue(view.yoga.isLeaf);
|
XCTAssertTrue(view.yoga.isLeaf);
|
||||||
@@ -351,18 +372,22 @@
|
|||||||
}
|
}
|
||||||
[container.yoga applyLayout];
|
[container.yoga applyLayout];
|
||||||
|
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 25), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
XCTAssertEqual(subview1.bounds.size.width, 100);
|
||||||
|
XCTAssertEqual(subview1.bounds.size.height, 25);
|
||||||
for (UIView *subview in subview1.subviews) {
|
for (UIView *subview in subview1.subviews) {
|
||||||
const CGSize subviewSize = subview.bounds.size;
|
const CGSize subviewSize = subview.bounds.size;
|
||||||
XCTAssertFalse(CGSizeEqualToSize(CGSizeZero, subviewSize));
|
XCTAssertNotEqual(subviewSize.width, 0);
|
||||||
|
XCTAssertNotEqual(subviewSize.height, 0);
|
||||||
XCTAssertFalse(isnan(subviewSize.height));
|
XCTAssertFalse(isnan(subviewSize.height));
|
||||||
XCTAssertFalse(isnan(subviewSize.width));
|
XCTAssertFalse(isnan(subviewSize.width));
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 25), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
XCTAssertEqual(subview2.bounds.size.width, 150);
|
||||||
|
XCTAssertEqual(subview2.bounds.size.height, 25);
|
||||||
for (UIView *subview in subview2.subviews) {
|
for (UIView *subview in subview2.subviews) {
|
||||||
const CGSize subviewSize = subview.bounds.size;
|
const CGSize subviewSize = subview.bounds.size;
|
||||||
XCTAssertFalse(CGSizeEqualToSize(CGSizeZero, subview.bounds.size));
|
XCTAssertNotEqual(subviewSize.width, 0);
|
||||||
|
XCTAssertNotEqual(subviewSize.height, 0);
|
||||||
XCTAssertFalse(isnan(subviewSize.height));
|
XCTAssertFalse(isnan(subviewSize.height));
|
||||||
XCTAssertFalse(isnan(subviewSize.width));
|
XCTAssertFalse(isnan(subviewSize.width));
|
||||||
}
|
}
|
||||||
|
5
YogaKit/YogaKitSample/Podfile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
use_frameworks!
|
||||||
|
|
||||||
|
target 'YogaKitSample' do
|
||||||
|
pod 'YogaKit', :path => '../../YogaKit.podspec'
|
||||||
|
end
|
19
YogaKit/YogaKitSample/Podfile.lock
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
PODS:
|
||||||
|
- Yoga (1.0.2)
|
||||||
|
- YogaKit (1.0.3):
|
||||||
|
- Yoga (~> 1.0)
|
||||||
|
|
||||||
|
DEPENDENCIES:
|
||||||
|
- YogaKit (from `../../YogaKit.podspec`)
|
||||||
|
|
||||||
|
EXTERNAL SOURCES:
|
||||||
|
YogaKit:
|
||||||
|
:path: "../../YogaKit.podspec"
|
||||||
|
|
||||||
|
SPEC CHECKSUMS:
|
||||||
|
Yoga: ef42f88b9bcbd7daf7267c0f19d8636ce3a50618
|
||||||
|
YogaKit: 6d9826a015c029b13731a33bf96fe6c1e33748a6
|
||||||
|
|
||||||
|
PODFILE CHECKSUM: 9db3bdea7f1b4b715ad859a449b2dc87fb6226cc
|
||||||
|
|
||||||
|
COCOAPODS: 1.2.0
|
@@ -11,18 +11,10 @@
|
|||||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4A1DF8748400E7C260 /* AppDelegate.m */; };
|
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4A1DF8748400E7C260 /* AppDelegate.m */; };
|
||||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4D1DF8748400E7C260 /* ViewController.m */; };
|
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4D1DF8748400E7C260 /* ViewController.m */; };
|
||||||
13687D531DF8748400E7C260 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13687D521DF8748400E7C260 /* Assets.xcassets */; };
|
13687D531DF8748400E7C260 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13687D521DF8748400E7C260 /* Assets.xcassets */; };
|
||||||
13687D781DF878C600E7C260 /* YGEnums.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D5E1DF8778F00E7C260 /* YGEnums.h */; };
|
|
||||||
13687D791DF878C600E7C260 /* YGMacros.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D5F1DF8778F00E7C260 /* YGMacros.h */; };
|
|
||||||
13687D7A1DF878C600E7C260 /* Yoga.h in yoga */ = {isa = PBXBuildFile; fileRef = 13687D631DF8778F00E7C260 /* Yoga.h */; };
|
|
||||||
13687D7C1DF878DD00E7C260 /* UIView+Yoga.h in YogaKit */ = {isa = PBXBuildFile; fileRef = 13687D691DF8778F00E7C260 /* UIView+Yoga.h */; };
|
|
||||||
13687D801DF87CEC00E7C260 /* UIView+Yoga.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */; };
|
|
||||||
13687D811DF87CF200E7C260 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 13687D601DF8778F00E7C260 /* YGNodeList.c */; };
|
|
||||||
13687D821DF87CF200E7C260 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = 13687D621DF8778F00E7C260 /* Yoga.c */; };
|
|
||||||
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D841DF87D1E00E7C260 /* UIKit.framework */; };
|
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D841DF87D1E00E7C260 /* UIKit.framework */; };
|
||||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; };
|
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; };
|
||||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 638A94411E1EF5D000A726AD /* YGLayout.m */; };
|
15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */; };
|
||||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638A94471E1F06D100A726AD /* SwiftViewController.swift */; };
|
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638A94471E1F06D100A726AD /* SwiftViewController.swift */; };
|
||||||
638A945A1E215CD400A726AD /* YogaKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 638A94591E215CD400A726AD /* YogaKitTests.m */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -42,9 +34,6 @@
|
|||||||
dstPath = include/yoga;
|
dstPath = include/yoga;
|
||||||
dstSubfolderSpec = 16;
|
dstSubfolderSpec = 16;
|
||||||
files = (
|
files = (
|
||||||
13687D781DF878C600E7C260 /* YGEnums.h in yoga */,
|
|
||||||
13687D791DF878C600E7C260 /* YGMacros.h in yoga */,
|
|
||||||
13687D7A1DF878C600E7C260 /* Yoga.h in yoga */,
|
|
||||||
);
|
);
|
||||||
name = yoga;
|
name = yoga;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -55,7 +44,6 @@
|
|||||||
dstPath = include/YogaKit;
|
dstPath = include/YogaKit;
|
||||||
dstSubfolderSpec = 16;
|
dstSubfolderSpec = 16;
|
||||||
files = (
|
files = (
|
||||||
13687D7C1DF878DD00E7C260 /* UIView+Yoga.h in YogaKit */,
|
|
||||||
);
|
);
|
||||||
name = YogaKit;
|
name = YogaKit;
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -71,24 +59,13 @@
|
|||||||
13687D4D1DF8748400E7C260 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
13687D4D1DF8748400E7C260 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||||
13687D521DF8748400E7C260 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
13687D521DF8748400E7C260 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
13687D571DF8748400E7C260 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
13687D5E1DF8778F00E7C260 /* YGEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = "<group>"; };
|
|
||||||
13687D5F1DF8778F00E7C260 /* YGMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = "<group>"; };
|
|
||||||
13687D601DF8778F00E7C260 /* YGNodeList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = YGNodeList.c; sourceTree = "<group>"; };
|
|
||||||
13687D611DF8778F00E7C260 /* YGNodeList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNodeList.h; sourceTree = "<group>"; };
|
|
||||||
13687D621DF8778F00E7C260 /* Yoga.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Yoga.c; sourceTree = "<group>"; };
|
|
||||||
13687D631DF8778F00E7C260 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = "<group>"; };
|
|
||||||
13687D691DF8778F00E7C260 /* UIView+Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Yoga.h"; sourceTree = "<group>"; };
|
|
||||||
13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Yoga.m"; sourceTree = "<group>"; };
|
|
||||||
13687D841DF87D1E00E7C260 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
13687D841DF87D1E00E7C260 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||||
13687D861DF87D2400E7C260 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
13687D861DF87D2400E7C260 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||||
638A94401E1EF5D000A726AD /* YGLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGLayout.h; sourceTree = "<group>"; };
|
1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
638A94411E1EF5D000A726AD /* YGLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YGLayout.m; sourceTree = "<group>"; };
|
|
||||||
638A94421E1EF5D000A726AD /* YGLayout+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YGLayout+Private.h"; sourceTree = "<group>"; };
|
|
||||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YogaKitSample-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
||||||
638A94471E1F06D100A726AD /* SwiftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftViewController.swift; sourceTree = "<group>"; };
|
638A94471E1F06D100A726AD /* SwiftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftViewController.swift; sourceTree = "<group>"; };
|
||||||
638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YogaKitSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
638A94531E215CC800A726AD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YogaKitSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
638A94591E215CD400A726AD /* YogaKitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = YogaKitTests.m; path = ../../Tests/YogaKitTests.m; sourceTree = "<group>"; };
|
C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -98,6 +75,7 @@
|
|||||||
files = (
|
files = (
|
||||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */,
|
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */,
|
||||||
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */,
|
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */,
|
||||||
|
15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -114,12 +92,10 @@
|
|||||||
13687D3A1DF8748300E7C260 = {
|
13687D3A1DF8748300E7C260 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
13687D5D1DF8778F00E7C260 /* yoga */,
|
|
||||||
13687D641DF8778F00E7C260 /* YogaKit */,
|
|
||||||
13687D451DF8748400E7C260 /* YogaKitSample */,
|
13687D451DF8748400E7C260 /* YogaKitSample */,
|
||||||
638A94501E215CC800A726AD /* YogaKitSampleTests */,
|
|
||||||
13687D441DF8748400E7C260 /* Products */,
|
13687D441DF8748400E7C260 /* Products */,
|
||||||
13687D831DF87D1E00E7C260 /* Frameworks */,
|
13687D831DF87D1E00E7C260 /* Frameworks */,
|
||||||
|
E1C759E3C8E84821213ECE8D /* Pods */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -140,7 +116,6 @@
|
|||||||
13687D4C1DF8748400E7C260 /* ViewController.h */,
|
13687D4C1DF8748400E7C260 /* ViewController.h */,
|
||||||
13687D4D1DF8748400E7C260 /* ViewController.m */,
|
13687D4D1DF8748400E7C260 /* ViewController.m */,
|
||||||
638A94471E1F06D100A726AD /* SwiftViewController.swift */,
|
638A94471E1F06D100A726AD /* SwiftViewController.swift */,
|
||||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */,
|
|
||||||
13687D521DF8748400E7C260 /* Assets.xcassets */,
|
13687D521DF8748400E7C260 /* Assets.xcassets */,
|
||||||
13687D571DF8748400E7C260 /* Info.plist */,
|
13687D571DF8748400E7C260 /* Info.plist */,
|
||||||
13687D461DF8748400E7C260 /* Supporting Files */,
|
13687D461DF8748400E7C260 /* Supporting Files */,
|
||||||
@@ -156,49 +131,23 @@
|
|||||||
name = "Supporting Files";
|
name = "Supporting Files";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
13687D5D1DF8778F00E7C260 /* yoga */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
13687D5E1DF8778F00E7C260 /* YGEnums.h */,
|
|
||||||
13687D5F1DF8778F00E7C260 /* YGMacros.h */,
|
|
||||||
13687D601DF8778F00E7C260 /* YGNodeList.c */,
|
|
||||||
13687D611DF8778F00E7C260 /* YGNodeList.h */,
|
|
||||||
13687D621DF8778F00E7C260 /* Yoga.c */,
|
|
||||||
13687D631DF8778F00E7C260 /* Yoga.h */,
|
|
||||||
);
|
|
||||||
name = yoga;
|
|
||||||
path = ../../yoga;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
13687D641DF8778F00E7C260 /* YogaKit */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
13687D691DF8778F00E7C260 /* UIView+Yoga.h */,
|
|
||||||
13687D6A1DF8778F00E7C260 /* UIView+Yoga.m */,
|
|
||||||
638A94401E1EF5D000A726AD /* YGLayout.h */,
|
|
||||||
638A94421E1EF5D000A726AD /* YGLayout+Private.h */,
|
|
||||||
638A94411E1EF5D000A726AD /* YGLayout.m */,
|
|
||||||
);
|
|
||||||
name = YogaKit;
|
|
||||||
path = ..;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
13687D831DF87D1E00E7C260 /* Frameworks */ = {
|
13687D831DF87D1E00E7C260 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
13687D861DF87D2400E7C260 /* Foundation.framework */,
|
13687D861DF87D2400E7C260 /* Foundation.framework */,
|
||||||
13687D841DF87D1E00E7C260 /* UIKit.framework */,
|
13687D841DF87D1E00E7C260 /* UIKit.framework */,
|
||||||
|
C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
638A94501E215CC800A726AD /* YogaKitSampleTests */ = {
|
E1C759E3C8E84821213ECE8D /* Pods */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
638A94591E215CD400A726AD /* YogaKitTests.m */,
|
1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */,
|
||||||
638A94531E215CC800A726AD /* Info.plist */,
|
82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */,
|
||||||
);
|
);
|
||||||
path = YogaKitSampleTests;
|
name = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
@@ -208,11 +157,14 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 13687D5A1DF8748400E7C260 /* Build configuration list for PBXNativeTarget "YogaKitSample" */;
|
buildConfigurationList = 13687D5A1DF8748400E7C260 /* Build configuration list for PBXNativeTarget "YogaKitSample" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
|
513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */,
|
||||||
13687D771DF878A000E7C260 /* yoga */,
|
13687D771DF878A000E7C260 /* yoga */,
|
||||||
13687D7B1DF878CE00E7C260 /* YogaKit */,
|
13687D7B1DF878CE00E7C260 /* YogaKit */,
|
||||||
13687D3F1DF8748300E7C260 /* Sources */,
|
13687D3F1DF8748300E7C260 /* Sources */,
|
||||||
13687D401DF8748300E7C260 /* Frameworks */,
|
13687D401DF8748300E7C260 /* Frameworks */,
|
||||||
13687D411DF8748300E7C260 /* Resources */,
|
13687D411DF8748300E7C260 /* Resources */,
|
||||||
|
FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */,
|
||||||
|
6E01EB987F1564F3D71EBE5A /* [CP] Copy Pods Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -299,19 +251,63 @@
|
|||||||
};
|
};
|
||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
|
513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "[CP] Check Pods Manifest.lock";
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
6E01EB987F1564F3D71EBE5A /* [CP] Copy Pods Resources */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "[CP] Copy Pods Resources";
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-resources.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-YogaKitSample/Pods-YogaKitSample-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
13687D3F1DF8748300E7C260 /* Sources */ = {
|
13687D3F1DF8748300E7C260 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */,
|
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */,
|
||||||
13687D801DF87CEC00E7C260 /* UIView+Yoga.m in Sources */,
|
|
||||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */,
|
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */,
|
||||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */,
|
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */,
|
||||||
13687D821DF87CF200E7C260 /* Yoga.c in Sources */,
|
|
||||||
13687D811DF87CF200E7C260 /* YGNodeList.c in Sources */,
|
|
||||||
13687D481DF8748400E7C260 /* main.m in Sources */,
|
13687D481DF8748400E7C260 /* main.m in Sources */,
|
||||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -319,7 +315,6 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
638A945A1E215CD400A726AD /* YogaKitTests.m in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -426,6 +421,7 @@
|
|||||||
};
|
};
|
||||||
13687D5B1DF8748400E7C260 /* Debug */ = {
|
13687D5B1DF8748400E7C260 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
@@ -433,7 +429,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
SWIFT_INSTALL_OBJC_HEADER = NO;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
@@ -441,6 +437,7 @@
|
|||||||
};
|
};
|
||||||
13687D5C1DF8748400E7C260 /* Release */ = {
|
13687D5C1DF8748400E7C260 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
|
baseConfigurationReference = 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
@@ -448,7 +445,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
SWIFT_INSTALL_OBJC_HEADER = NO;
|
||||||
SWIFT_VERSION = 3.0;
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@@ -509,6 +506,7 @@
|
|||||||
638A94581E215CC800A726AD /* Release */,
|
638A94581E215CC800A726AD /* Release */,
|
||||||
);
|
);
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
};
|
};
|
||||||
|
10
YogaKit/YogaKitSample/YogaKitSample.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "group:YogaKitSample.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
|
<FileRef
|
||||||
|
location = "group:Pods/Pods.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
@@ -13,4 +13,3 @@
|
|||||||
@property (strong, nonatomic) UIWindow *window;
|
@property (strong, nonatomic) UIWindow *window;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -1,43 +1,69 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-20x20@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "20x20",
|
"size" : "20x20",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-20x20@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"scale" : "2x"
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-29x29@1x.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
|
||||||
"size" : "29x29",
|
"size" : "29x29",
|
||||||
"scale" : "3x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "40x40",
|
"filename" : "Yoga-29x29@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"size" : "29x29",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "40x40",
|
"filename" : "Yoga-29x29@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"size" : "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "60x60",
|
"filename" : "Yoga-40x40@2x.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"size" : "40x40",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-40x40@3x.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size" : "57x57",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-57x57@1x.png",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size" : "57x57",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-57x57@2x.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
"size" : "60x60",
|
"size" : "60x60",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-60x60@2x.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size" : "60x60",
|
||||||
|
"idiom" : "iphone",
|
||||||
|
"filename" : "Yoga-60x60@3x.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 868 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 7.4 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
@@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import YogaKit
|
||||||
|
|
||||||
class SwiftViewController: UIViewController {
|
class SwiftViewController: UIViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
@@ -10,6 +10,4 @@
|
|||||||
|
|
||||||
@interface ViewController : UIViewController
|
@interface ViewController : UIViewController
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2014-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the license found in the
|
|
||||||
* LICENSE-examples file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "UIView+Yoga.h"
|
|
||||||
#import <yoga/Yoga.h>
|
|
@@ -12,10 +12,10 @@
|
|||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
static YGSize _measure(YGNodeRef node,
|
static YGSize _measure(YGNodeRef node,
|
||||||
float width,
|
float width,
|
||||||
YGMeasureMode widthMode,
|
YGMeasureMode widthMode,
|
||||||
float height,
|
float height,
|
||||||
YGMeasureMode heightMode) {
|
YGMeasureMode heightMode) {
|
||||||
return (YGSize){
|
return (YGSize){
|
||||||
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||||
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
|
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#define NUM_REPETITIONS 1000
|
#define NUM_REPETITIONS 1000
|
||||||
|
|
||||||
#define YGBENCHMARKS(BLOCK) \
|
#define YGBENCHMARKS(BLOCK) \
|
||||||
int main(int argc, char const *argv[]) { \
|
int main(int argc, char const *argv[]) { \
|
||||||
clock_t __start; \
|
clock_t __start; \
|
||||||
clock_t __endTimes[NUM_REPETITIONS]; \
|
clock_t __endTimes[NUM_REPETITIONS]; \
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YGBENCHMARK(NAME, BLOCK) \
|
#define YGBENCHMARK(NAME, BLOCK) \
|
||||||
__start = clock(); \
|
__start = clock(); \
|
||||||
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
||||||
{ BLOCK } \
|
{ BLOCK } \
|
||||||
|
1
csharp/Android/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lib/
|
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{2021459E-8FB1-44A4-89F1-E291769CD2C6}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Facebook.Yoga.Android.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Facebook.Yoga.Android.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
|
||||||
|
<AndroidApplication>True</AndroidApplication>
|
||||||
|
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||||
|
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||||
|
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||||
|
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||||
|
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||||
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||||
|
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Mono.Android" />
|
||||||
|
<Reference Include="Xamarin.Android.NUnitLite" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="MainActivity.cs" />
|
||||||
|
<Compile Include="Resources\Resource.designer.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Facebook.Yoga.Android\Facebook.Yoga.Android.csproj">
|
||||||
|
<Project>{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}</Project>
|
||||||
|
<Name>Facebook.Yoga.Android</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
|
</Project>
|
25
csharp/Android/Facebook.Yoga.Android.Tests/MainActivity.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2014-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the license found in the
|
||||||
|
* LICENSE-examples file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
using Android.App;
|
||||||
|
using Android.OS;
|
||||||
|
using Xamarin.Android.NUnitLite;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga.Android.Tests
|
||||||
|
{
|
||||||
|
[Activity(Label = "Facebook.Yoga.Android.Tests", MainLauncher = true)]
|
||||||
|
public class MainActivity : TestSuiteActivity
|
||||||
|
{
|
||||||
|
protected override void OnCreate(Bundle bundle)
|
||||||
|
{
|
||||||
|
AddTest(Assembly.GetExecutingAssembly());
|
||||||
|
base.OnCreate(bundle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0"
|
||||||
|
package="Facebook.Yoga.Android.Tests">
|
||||||
|
|
||||||
|
<uses-sdk
|
||||||
|
android:minSdkVersion="19" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:label="Facebook.Yoga.Android.Tests">
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
0
csharp/Android/Facebook.Yoga.Android.Tests/Resources/Resource.designer.cs
generated
Normal file
33
csharp/Android/Facebook.Yoga.Android.sln
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2012
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android.Tests", "Facebook.Yoga.Android.Tests\Facebook.Yoga.Android.Tests.csproj", "{2021459E-8FB1-44A4-89F1-E291769CD2C6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.Android", "Facebook.Yoga.Android\Facebook.Yoga.Android.csproj", "{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||||
|
EndProject
|
||||||
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared.Tests", "..\tests\Facebook.Yoga\Facebook.Yoga.Shared.Tests.shproj", "{4EDC82D9-A201-4831-8FE0-98F468F8E4AE}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2021459E-8FB1-44A4-89F1-E291769CD2C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2021459E-8FB1-44A4-89F1-E291769CD2C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
{91C42D32-291D-4B72-90B4-551663D60B8B} = {4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A}
|
||||||
|
{4EDC82D9-A201-4831-8FE0-98F468F8E4AE} = {4804A8E6-E7B7-4F9E-A446-3DE8E73DB38A}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<BuildDependsOn>NativeLibraryARMV7;NativeLibraryX86;$(BuildDependsOn)</BuildDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="NativeLibraryARMV7" Outputs="$(ProjectDir)/lib/armeabi-v7a/libyoga.so">
|
||||||
|
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)../../Mac/buck-build.sh //csharp:yoganet#android-armv7,shared" />
|
||||||
|
<Copy SourceFiles="$(ProjectDir)../../../buck-out/gen/csharp/yoganet#android-armv7,shared/libyoga.so" DestinationFiles="$(ProjectDir)/lib/armeabi-v7a/libyoga.so" SkipUnchangedFiles="true" />
|
||||||
|
</Target>
|
||||||
|
<!--
|
||||||
|
<Target Name="NativeLibraryARM64" Outputs="$(ProjectDir)/lib/arm64-v8a/libyoga.so">
|
||||||
|
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)../../Mac/buck-build.sh //csharp:yoganet#android-arm64,shared" />
|
||||||
|
<Copy SourceFiles="$(ProjectDir)../../../buck-out/gen/csharp/yoganet#android-arm64,shared/libyoga.so" DestinationFiles="$(ProjectDir)/lib/arm64-v8/libyoga.so" SkipUnchangedFiles="true" />
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
<Target Name="NativeLibraryX86" Outputs="$(ProjectDir)/lib/x86/libyoga.so">
|
||||||
|
<Exec WorkingDirectory="$(ProjectDir)" Command="$(ProjectDir)../../Mac/buck-build.sh //csharp:yoganet#android-x86,shared" />
|
||||||
|
<Copy SourceFiles="$(ProjectDir)../../../buck-out/gen/csharp/yoganet#android-x86,shared/libyoga.so" DestinationFiles="$(ProjectDir)/lib/x86/libyoga.so" SkipUnchangedFiles="true" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
@@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{EDF7CF8B-5640-4E1D-A2C7-E4BC8BE44363}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Facebook.Yoga.Android</RootNamespace>
|
||||||
|
<AssemblyName>Facebook.Yoga.Android</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
|
||||||
|
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||||
|
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||||
|
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||||
|
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||||
|
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
|
<AndroidSupportedAbis>arm64-v8a;armeabi;armeabi-v7a;x86</AndroidSupportedAbis>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||||
|
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Mono.Android" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="CustomBuildAction.targets" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="lib\x86\" />
|
||||||
|
<Folder Include="lib\armeabi-v7a\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedNativeLibrary Include="lib\x86\libyoga.so">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedNativeLibrary>
|
||||||
|
<EmbeddedNativeLibrary Include="lib\armeabi-v7a\libyoga.so">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedNativeLibrary>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems" Label="Shared" Condition="Exists('..\..\Facebook.Yoga\Facebook.Yoga.Shared.projitems')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
|
<Import Project="CustomBuildAction.targets" />
|
||||||
|
</Project>
|
0
csharp/Android/Facebook.Yoga.Android/Resources/Resource.designer.cs
generated
Normal file
@@ -1,32 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
|
||||||
{
|
|
||||||
[System.Obsolete]
|
|
||||||
public class Border
|
|
||||||
{
|
|
||||||
public float? Top;
|
|
||||||
public float? Bottom;
|
|
||||||
public float? Left;
|
|
||||||
public float? Right;
|
|
||||||
|
|
||||||
public Border(
|
|
||||||
float? top = null,
|
|
||||||
float? bottom = null,
|
|
||||||
float? left = null,
|
|
||||||
float? right = null)
|
|
||||||
{
|
|
||||||
Top = top;
|
|
||||||
Bottom = bottom;
|
|
||||||
Left = left;
|
|
||||||
Right = right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -10,11 +10,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)BaselineFunction.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)BaselineFunction.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Border.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureFunction.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)MeasureFunction.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureOutput.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)MeasureOutput.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Native.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Native.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Spacing.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaAlign.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaAlign.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaBaselineFunc.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaBaselineFunc.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaConstants.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaConstants.cs" />
|
||||||
@@ -28,7 +26,6 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaLogLevel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaLogLevel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureFunc.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureFunc.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureMode.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureMode.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Create.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Spacing.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Spacing.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaOverflow.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaOverflow.cs" />
|
||||||
@@ -40,4 +37,4 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaValueExtensions.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaValueExtensions.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)YogaWrap.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)YogaWrap.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -169,6 +169,12 @@ namespace Facebook.Yoga
|
|||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern YogaOverflow YGNodeStyleGetOverflow(YGNodeHandle node);
|
public static extern YogaOverflow YGNodeStyleGetOverflow(YGNodeHandle node);
|
||||||
|
|
||||||
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void YGNodeStyleSetDisplay(YGNodeHandle node, YogaDisplay display);
|
||||||
|
|
||||||
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern YogaDisplay YGNodeStyleGetDisplay(YGNodeHandle node);
|
||||||
|
|
||||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void YGNodeStyleSetFlex(YGNodeHandle node, float flex);
|
public static extern void YGNodeStyleSetFlex(YGNodeHandle node, float flex);
|
||||||
|
|
||||||
|
@@ -1,32 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
|
||||||
{
|
|
||||||
[System.Obsolete]
|
|
||||||
public class Spacing
|
|
||||||
{
|
|
||||||
public YogaValue? Top;
|
|
||||||
public YogaValue? Bottom;
|
|
||||||
public YogaValue? Left;
|
|
||||||
public YogaValue? Right;
|
|
||||||
|
|
||||||
public Spacing(
|
|
||||||
YogaValue? top = null,
|
|
||||||
YogaValue? bottom = null,
|
|
||||||
YogaValue? left = null,
|
|
||||||
YogaValue? right = null)
|
|
||||||
{
|
|
||||||
Top = top;
|
|
||||||
Bottom = bottom;
|
|
||||||
Left = left;
|
|
||||||
Right = right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
17
csharp/Facebook.Yoga/YogaDisplay.cs
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Facebook.Yoga
|
||||||
|
{
|
||||||
|
public enum YogaDisplay
|
||||||
|
{
|
||||||
|
Flex,
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
}
|
@@ -1,234 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
|
||||||
{
|
|
||||||
public partial class YogaNode
|
|
||||||
{
|
|
||||||
[Obsolete("use Object Initializer")]
|
|
||||||
public static YogaNode Create(
|
|
||||||
YogaDirection? styleDirection = null,
|
|
||||||
YogaFlexDirection? flexDirection = null,
|
|
||||||
YogaJustify? justifyContent = null,
|
|
||||||
YogaAlign? alignContent = null,
|
|
||||||
YogaAlign? alignItems = null,
|
|
||||||
YogaAlign? alignSelf = null,
|
|
||||||
YogaPositionType? positionType = null,
|
|
||||||
YogaWrap? wrap = null,
|
|
||||||
YogaOverflow? overflow = null,
|
|
||||||
float? flex = null,
|
|
||||||
float? flexGrow = null,
|
|
||||||
float? flexShrink = null,
|
|
||||||
YogaValue? flexBasis = null,
|
|
||||||
Spacing position = null,
|
|
||||||
Spacing margin = null,
|
|
||||||
Spacing padding = null,
|
|
||||||
Border border = null,
|
|
||||||
YogaValue? width = null,
|
|
||||||
YogaValue? height = null,
|
|
||||||
YogaValue? maxWidth = null,
|
|
||||||
YogaValue? maxHeight = null,
|
|
||||||
YogaValue? minWidth = null,
|
|
||||||
YogaValue? minHeight = null)
|
|
||||||
{
|
|
||||||
YogaNode node = new YogaNode();
|
|
||||||
|
|
||||||
if (styleDirection.HasValue)
|
|
||||||
{
|
|
||||||
node.StyleDirection = styleDirection.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flexDirection.HasValue)
|
|
||||||
{
|
|
||||||
node.FlexDirection = flexDirection.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (justifyContent.HasValue)
|
|
||||||
{
|
|
||||||
node.JustifyContent = justifyContent.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alignContent.HasValue)
|
|
||||||
{
|
|
||||||
node.AlignContent = alignContent.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alignItems.HasValue)
|
|
||||||
{
|
|
||||||
node.AlignItems = alignItems.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alignSelf.HasValue)
|
|
||||||
{
|
|
||||||
node.AlignSelf = alignSelf.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (positionType.HasValue)
|
|
||||||
{
|
|
||||||
node.PositionType = positionType.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wrap.HasValue)
|
|
||||||
{
|
|
||||||
node.Wrap = wrap.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overflow.HasValue)
|
|
||||||
{
|
|
||||||
node.Overflow = overflow.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flex.HasValue)
|
|
||||||
{
|
|
||||||
node.Flex = flex.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flexGrow.HasValue)
|
|
||||||
{
|
|
||||||
node.FlexGrow = flexGrow.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flexShrink.HasValue)
|
|
||||||
{
|
|
||||||
node.FlexShrink = flexShrink.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flexBasis.HasValue)
|
|
||||||
{
|
|
||||||
node.FlexBasis = flexBasis.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position != null)
|
|
||||||
{
|
|
||||||
if (position.Top.HasValue)
|
|
||||||
{
|
|
||||||
node.Top = position.Top.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position.Bottom.HasValue)
|
|
||||||
{
|
|
||||||
node.Bottom = position.Bottom.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position.Left.HasValue)
|
|
||||||
{
|
|
||||||
node.Left = position.Left.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position.Right.HasValue)
|
|
||||||
{
|
|
||||||
node.Right = position.Right.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (margin != null)
|
|
||||||
{
|
|
||||||
if (margin.Top.HasValue)
|
|
||||||
{
|
|
||||||
node.MarginTop = margin.Top.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (margin.Bottom.HasValue)
|
|
||||||
{
|
|
||||||
node.MarginBottom = margin.Bottom.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (margin.Left.HasValue)
|
|
||||||
{
|
|
||||||
node.MarginLeft = margin.Left.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (margin.Right.HasValue)
|
|
||||||
{
|
|
||||||
node.MarginRight = margin.Right.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (padding != null)
|
|
||||||
{
|
|
||||||
if (padding.Top.HasValue)
|
|
||||||
{
|
|
||||||
node.PaddingTop = padding.Top.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (padding.Bottom.HasValue)
|
|
||||||
{
|
|
||||||
node.PaddingBottom = padding.Bottom.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (padding.Left.HasValue)
|
|
||||||
{
|
|
||||||
node.PaddingLeft = padding.Left.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (padding.Right.HasValue)
|
|
||||||
{
|
|
||||||
node.PaddingRight = padding.Right.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (border != null)
|
|
||||||
{
|
|
||||||
if (border.Top.HasValue)
|
|
||||||
{
|
|
||||||
node.BorderTopWidth = border.Top.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (border.Bottom.HasValue)
|
|
||||||
{
|
|
||||||
node.BorderBottomWidth = border.Bottom.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (border.Left.HasValue)
|
|
||||||
{
|
|
||||||
node.BorderLeftWidth = border.Left.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (border.Right.HasValue)
|
|
||||||
{
|
|
||||||
node.BorderRightWidth = border.Right.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width.HasValue)
|
|
||||||
{
|
|
||||||
node.Width = width.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (height.HasValue)
|
|
||||||
{
|
|
||||||
node.Height = height.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minWidth.HasValue)
|
|
||||||
{
|
|
||||||
node.MinWidth = minWidth.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minHeight.HasValue)
|
|
||||||
{
|
|
||||||
node.MinHeight = minHeight.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxWidth.HasValue)
|
|
||||||
{
|
|
||||||
node.MaxWidth = maxWidth.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxHeight.HasValue)
|
|
||||||
{
|
|
||||||
node.MaxHeight = maxHeight.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -145,6 +145,19 @@ namespace Facebook.Yoga
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YogaDisplay Display
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Native.YGNodeStyleGetDisplay(_ygNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Native.YGNodeStyleSetDisplay(_ygNode, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public YogaAlign AlignItems
|
public YogaAlign AlignItems
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -264,81 +277,6 @@ namespace Facebook.Yoga
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("use Margin properties")]
|
|
||||||
public YogaValue GetMargin(YogaEdge edge)
|
|
||||||
{
|
|
||||||
return Native.YGNodeStyleGetMargin(_ygNode, edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use Margin properties")]
|
|
||||||
public void SetMargin(YogaEdge edge, YogaValue value)
|
|
||||||
{
|
|
||||||
if (value.Unit == YogaUnit.Percent)
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetMarginPercent(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetMargin(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use Padding properties")]
|
|
||||||
public YogaValue GetPadding(YogaEdge edge)
|
|
||||||
{
|
|
||||||
return Native.YGNodeStyleGetPadding(_ygNode, edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use Padding properties")]
|
|
||||||
public void SetPadding(YogaEdge edge, YogaValue value)
|
|
||||||
{
|
|
||||||
if (value.Unit == YogaUnit.Percent)
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetPaddingPercent(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetPadding(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use BorderWidth properties")]
|
|
||||||
public float GetBorder(YogaEdge edge)
|
|
||||||
{
|
|
||||||
return Native.YGNodeStyleGetBorder(_ygNode, edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use BorderWidth properties")]
|
|
||||||
public void SetBorder(YogaEdge edge, float border)
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetBorder(_ygNode, edge, border);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use Position properties")]
|
|
||||||
public YogaValue GetPosition(YogaEdge edge)
|
|
||||||
{
|
|
||||||
return Native.YGNodeStyleGetPosition(_ygNode, edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use Position properties")]
|
|
||||||
public void SetPosition(YogaEdge edge, YogaValue value)
|
|
||||||
{
|
|
||||||
if (value.Unit == YogaUnit.Percent)
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetPositionPercent(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Native.YGNodeStyleSetPosition(_ygNode, edge, value.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete("use LayoutPadding properties")]
|
|
||||||
public float GetLayoutPadding(YogaEdge edge)
|
|
||||||
{
|
|
||||||
return Native.YGNodeLayoutGetPadding(_ygNode, edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue Width
|
public YogaValue Width
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@@ -10,18 +10,13 @@
|
|||||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||||
DWORD ul_reason_for_call,
|
switch (ul_reason_for_call) {
|
||||||
LPVOID lpReserved
|
case DLL_PROCESS_ATTACH:
|
||||||
)
|
case DLL_THREAD_ATTACH:
|
||||||
{
|
case DLL_THREAD_DETACH:
|
||||||
switch (ul_reason_for_call)
|
case DLL_PROCESS_DETACH:
|
||||||
{
|
break;
|
||||||
case DLL_PROCESS_ATTACH:
|
}
|
||||||
case DLL_THREAD_ATTACH:
|
return TRUE;
|
||||||
case DLL_THREAD_DETACH:
|
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -16,10 +16,8 @@
|
|||||||
|
|
||||||
#include "targetver.h"
|
#include "targetver.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
// Windows Header Files:
|
// Windows Header Files:
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: reference additional headers your program requires here
|
// TODO: reference additional headers your program requires here
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -310,5 +310,384 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_center()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_flex_end()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.FlexEnd;
|
||||||
|
root.AlignItems = YogaAlign.FlexEnd;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_justify_content_center()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_center()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_center_on_child_only()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.AlignSelf = YogaAlign.Center;
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_center_and_top_position()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Top = 10;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_center_and_bottom_position()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Bottom = 10;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(25f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_center_and_left_position()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Left = 5;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(5f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(5f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_absolute_layout_align_items_and_justify_content_center_and_right_position()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.FlexGrow = 1;
|
||||||
|
root.Width = 110;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.PositionType = YogaPositionType.Absolute;
|
||||||
|
root_child0.Right = 5;
|
||||||
|
root_child0.Width = 60;
|
||||||
|
root_child0.Height = 40;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(45f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(110f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(45f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(30f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(60f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
106
csharp/tests/Facebook.Yoga/YGDimensionTest.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class YGDimensionTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void Test_wrap_child()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.Width = 100;
|
||||||
|
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(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, 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(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_wrap_grandchild()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child0_child0 = new YogaNode();
|
||||||
|
root_child0_child0.Width = 100;
|
||||||
|
root_child0_child0.Height = 100;
|
||||||
|
root_child0.Insert(0, root_child0_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
332
csharp/tests/Facebook.Yoga/YGDisplayTest.cs
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Facebook.Yoga
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class YGDisplayTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void Test_display_none()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.Display = YogaDisplay.None;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_display_none_fixed_size()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.Width = 20;
|
||||||
|
root_child1.Height = 20;
|
||||||
|
root_child1.Display = YogaDisplay.None;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_display_none_with_margin()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.MarginLeft = 10;
|
||||||
|
root_child0.MarginTop = 10;
|
||||||
|
root_child0.MarginRight = 10;
|
||||||
|
root_child0.MarginBottom = 10;
|
||||||
|
root_child0.Width = 20;
|
||||||
|
root_child0.Height = 20;
|
||||||
|
root_child0.Display = YogaDisplay.None;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, 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(0f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, 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(0f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_display_none_with_child()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.FlexShrink = 1;
|
||||||
|
root_child0.FlexBasis = 0.Percent();
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.FlexShrink = 1;
|
||||||
|
root_child1.FlexBasis = 0.Percent();
|
||||||
|
root_child1.Display = YogaDisplay.None;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
|
||||||
|
YogaNode root_child1_child0 = new YogaNode();
|
||||||
|
root_child1_child0.FlexGrow = 1;
|
||||||
|
root_child1_child0.FlexShrink = 1;
|
||||||
|
root_child1_child0.FlexBasis = 0.Percent();
|
||||||
|
root_child1_child0.Width = 20;
|
||||||
|
root_child1_child0.MinWidth = 0;
|
||||||
|
root_child1_child0.MinHeight = 0;
|
||||||
|
root_child1.Insert(0, root_child1_child0);
|
||||||
|
|
||||||
|
YogaNode root_child2 = new YogaNode();
|
||||||
|
root_child2.FlexGrow = 1;
|
||||||
|
root_child2.FlexShrink = 1;
|
||||||
|
root_child2.FlexBasis = 0.Percent();
|
||||||
|
root.Insert(2, root_child2);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(50f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child2.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child2.LayoutY);
|
||||||
|
Assert.AreEqual(50f, root_child2.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child2.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_display_none_with_position()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.FlexGrow = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.FlexGrow = 1;
|
||||||
|
root_child1.Top = 10;
|
||||||
|
root_child1.Display = YogaDisplay.None;
|
||||||
|
root.Insert(1, root_child1);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child1.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -184,6 +184,7 @@ namespace Facebook.Yoga
|
|||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
root_child0.MarginStart = 10;
|
root_child0.MarginStart = 10;
|
||||||
|
root_child0.MarginEnd = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
root.StyleDirection = YogaDirection.LTR;
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -195,7 +196,7 @@ namespace Facebook.Yoga
|
|||||||
|
|
||||||
Assert.AreEqual(10f, root_child0.LayoutX);
|
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
@@ -206,9 +207,9 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(100f, root.LayoutWidth);
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root.LayoutHeight);
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,6 +223,7 @@ namespace Facebook.Yoga
|
|||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
root_child0.MarginTop = 10;
|
root_child0.MarginTop = 10;
|
||||||
|
root_child0.MarginBottom = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
root.StyleDirection = YogaDirection.LTR;
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -234,7 +236,7 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -247,7 +249,7 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -261,6 +263,7 @@ namespace Facebook.Yoga
|
|||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
root_child0.MarginTop = 10;
|
root_child0.MarginTop = 10;
|
||||||
|
root_child0.MarginBottom = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
root.StyleDirection = YogaDirection.LTR;
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -273,7 +276,7 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -286,7 +289,7 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -299,6 +302,7 @@ namespace Facebook.Yoga
|
|||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
root_child0.MarginStart = 10;
|
root_child0.MarginStart = 10;
|
||||||
|
root_child0.MarginEnd = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
root.StyleDirection = YogaDirection.LTR;
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -310,7 +314,7 @@ namespace Facebook.Yoga
|
|||||||
|
|
||||||
Assert.AreEqual(10f, root_child0.LayoutX);
|
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
@@ -321,9 +325,9 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(100f, root.LayoutWidth);
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root.LayoutHeight);
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +341,7 @@ namespace Facebook.Yoga
|
|||||||
|
|
||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.MarginEnd = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
YogaNode root_child1 = new YogaNode();
|
YogaNode root_child1 = new YogaNode();
|
||||||
@@ -352,12 +357,12 @@ 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(50f, root_child0.LayoutWidth);
|
Assert.AreEqual(45f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(50f, root_child1.LayoutX);
|
Assert.AreEqual(55f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
Assert.AreEqual(45f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
@@ -368,14 +373,14 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(100f, root.LayoutWidth);
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root.LayoutHeight);
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(50f, root_child0.LayoutX);
|
Assert.AreEqual(55f, root_child0.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
Assert.AreEqual(50f, root_child0.LayoutWidth);
|
Assert.AreEqual(45f, root_child0.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
Assert.AreEqual(45f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,6 +393,7 @@ namespace Facebook.Yoga
|
|||||||
|
|
||||||
YogaNode root_child0 = new YogaNode();
|
YogaNode root_child0 = new YogaNode();
|
||||||
root_child0.FlexGrow = 1;
|
root_child0.FlexGrow = 1;
|
||||||
|
root_child0.MarginBottom = 10;
|
||||||
root.Insert(0, root_child0);
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
YogaNode root_child1 = new YogaNode();
|
YogaNode root_child1 = new YogaNode();
|
||||||
@@ -404,12 +410,12 @@ 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(50f, root_child0.LayoutHeight);
|
Assert.AreEqual(45f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
Assert.AreEqual(55f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
Assert.AreEqual(45f, root_child1.LayoutHeight);
|
||||||
|
|
||||||
root.StyleDirection = YogaDirection.RTL;
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
root.CalculateLayout();
|
root.CalculateLayout();
|
||||||
@@ -422,12 +428,12 @@ 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(50f, root_child0.LayoutHeight);
|
Assert.AreEqual(45f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
Assert.AreEqual(55f, root_child1.LayoutY);
|
||||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
Assert.AreEqual(45f, root_child1.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@@ -955,5 +955,41 @@ namespace Facebook.Yoga
|
|||||||
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
YogaNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_percentage_width_height_undefined_parent_size()
|
||||||
|
{
|
||||||
|
YogaNode root = new YogaNode();
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.Width = 50.Percent();
|
||||||
|
root_child0.Height = 50.Percent();
|
||||||
|
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(0f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, 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(0f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@@ -1,115 +0,0 @@
|
|||||||
This provides guidance on how to contribute various content to `your-site`.
|
|
||||||
|
|
||||||
## Getting started
|
|
||||||
|
|
||||||
You should only have to do these one time.
|
|
||||||
|
|
||||||
- Rename this file to `CONTRIBUTING.md`.
|
|
||||||
- Rename `EXAMPLE-README-FOR-RUNNING-DOCS.md` to `README.md` (replacing the existing `README.md` that came with the template).
|
|
||||||
- Rename `EXAMPLE-LICENSE` to `LICENSE`.
|
|
||||||
- Review the [template information](./TEMPLATE-INFORMATION.md).
|
|
||||||
- Review `./_config.yml`.
|
|
||||||
- Make sure you update `title`, `description`, `tagline` and `gacode` (Google Analytics) in `./_config.yml`.
|
|
||||||
|
|
||||||
## Basic Structure
|
|
||||||
|
|
||||||
Most content is written in markdown. You name the file `something.md`, then have a header that looks like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
---
|
|
||||||
docid: getting-started
|
|
||||||
title: Getting started with ProjectName
|
|
||||||
layout: docs
|
|
||||||
permalink: /docs/getting-started.html
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
Customize these values for each document, blog post, etc.
|
|
||||||
|
|
||||||
> The filename of the `.md` file doesn't actually matter; what is important is the `docid` being unique and the `permalink` correct and unique too).
|
|
||||||
|
|
||||||
## Landing page
|
|
||||||
|
|
||||||
Modify `index.md` with your new or updated content.
|
|
||||||
|
|
||||||
If you want a `GridBlock` as part of your content, you can do so directly with HTML:
|
|
||||||
|
|
||||||
```
|
|
||||||
<div class="gridBlock">
|
|
||||||
<div class="blockElement twoByGridBlock alignLeft">
|
|
||||||
<div class="blockContent">
|
|
||||||
<h3>Your Features</h3>
|
|
||||||
<ul>
|
|
||||||
<li>The <a href="http://example.org/">Example</a></li>
|
|
||||||
<li><a href="http://example.com">Another Example</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="blockElement twoByGridBlock alignLeft">
|
|
||||||
<div class="blockContent">
|
|
||||||
<h3>More information</h3>
|
|
||||||
<p>
|
|
||||||
Stuff here
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
or with a combination of changing `./_data/features.yml` and adding some Liquid to `index.md`, such as:
|
|
||||||
|
|
||||||
```
|
|
||||||
{% include content/gridblocks.html data_source=site.data.features imagealign="bottom"%}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Blog
|
|
||||||
|
|
||||||
To modify a blog post, edit the appopriate markdown file in `./_posts/`.
|
|
||||||
|
|
||||||
Adding a new blog post is a four-step process.
|
|
||||||
|
|
||||||
> Some posts have a `permalink` and `comments` in the blog post YAML header. You will not need these for new blog posts. These are an artifact of migrating the blog from Wordpress to gh-pages.
|
|
||||||
|
|
||||||
1. Create your blog post in `./_posts/` in markdown (file extension `.md` or `.markdown`). See current posts in that folder or `./doc-type-examples/2016-04-07-blog-post-example.md` for an example of the YAML format. **If the `./_posts` directory does not exist, create it**.
|
|
||||||
- You can add a `<!--truncate-->` tag in the middle of your post such that you show only the excerpt above that tag in the main `/blog` index on your page.
|
|
||||||
1. If you have not authored a blog post before, modify the `./_data/authors.yml` file with the `author` id you used in your blog post, along with your full name and Facebook ID to get your profile picture.
|
|
||||||
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/blog/your-new-blog-post-title.html`
|
|
||||||
1. Push your changes to GitHub.
|
|
||||||
|
|
||||||
## Docs
|
|
||||||
|
|
||||||
To modify docs, edit the appropriate markdown file in `./_docs/`.
|
|
||||||
|
|
||||||
To add docs to the site....
|
|
||||||
|
|
||||||
1. Add your markdown file to the `./_docs/` folder. See `./doc-type-examples/docs-hello-world.md` for an example of the YAML header format. **If the `./_docs/` directory does not exist, create it**.
|
|
||||||
- You can use folders in the `./_docs/` directory to organize your content if you want.
|
|
||||||
1. Update `_data/nav_docs.yml` to add your new document to the navigation bar. Use the `docid` you put in your doc markdown in as the `id` in the `_data/nav_docs.yml` file.
|
|
||||||
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/docs/your-new-doc-permalink.html`
|
|
||||||
1. Push your changes to GitHub.
|
|
||||||
|
|
||||||
## Header Bar
|
|
||||||
|
|
||||||
To modify the header bar, change `./_data/nav.yml`.
|
|
||||||
|
|
||||||
## Top Level Page
|
|
||||||
|
|
||||||
To modify a top-level page, edit the appropriate markdown file in `./top-level/`
|
|
||||||
|
|
||||||
If you want a top-level page (e.g., http://your-site.com/top-level.html) -- not in `/blog/` or `/docs/`....
|
|
||||||
|
|
||||||
1. Create a markdown file in the root `./top-level/`. See `./doc-type-examples/top-level-example.md` for more information.
|
|
||||||
1. If you want a visible link to that file, update `_data/nav.yml` to add a link to your new top-level document in the header bar.
|
|
||||||
|
|
||||||
> This is not necessary if you just want to have a page that is linked to from another page, but not exposed as direct link to the user.
|
|
||||||
|
|
||||||
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/your-top-level-page-permalink.html`
|
|
||||||
1. Push your changes to GitHub.
|
|
||||||
|
|
||||||
## Other Changes
|
|
||||||
|
|
||||||
- CSS: `./css/main.css` or `./_sass/*.scss`.
|
|
||||||
- Images: `./static/images/[docs | posts]/....`
|
|
||||||
- Main Blog post HTML: `./_includes/post.html`
|
|
||||||
- Main Docs HTML: `./_includes/doc.html`
|
|
12
enums.py
@@ -52,6 +52,10 @@ ENUMS = {
|
|||||||
'Relative',
|
'Relative',
|
||||||
'Absolute',
|
'Absolute',
|
||||||
],
|
],
|
||||||
|
'Display': [
|
||||||
|
'Flex',
|
||||||
|
'None',
|
||||||
|
],
|
||||||
'Wrap': [
|
'Wrap': [
|
||||||
'NoWrap',
|
'NoWrap',
|
||||||
'Wrap',
|
'Wrap',
|
||||||
@@ -125,7 +129,7 @@ with open(root + '/yoga/YGEnums.h', 'w') as f:
|
|||||||
f.write('#pragma once\n\n')
|
f.write('#pragma once\n\n')
|
||||||
f.write('#include "YGMacros.h"\n\n')
|
f.write('#include "YGMacros.h"\n\n')
|
||||||
f.write('YG_EXTERN_C_BEGIN\n\n')
|
f.write('YG_EXTERN_C_BEGIN\n\n')
|
||||||
for name, values in ENUMS.items():
|
for name, values in sorted(ENUMS.items()):
|
||||||
f.write('#define YG%sCount %s\n' % (name, len(values)))
|
f.write('#define YG%sCount %s\n' % (name, len(values)))
|
||||||
f.write('typedef YG_ENUM_BEGIN(YG%s) {\n' % name)
|
f.write('typedef YG_ENUM_BEGIN(YG%s) {\n' % name)
|
||||||
for value in values:
|
for value in values:
|
||||||
@@ -138,7 +142,7 @@ with open(root + '/yoga/YGEnums.h', 'w') as f:
|
|||||||
f.write('YG_EXTERN_C_END\n')
|
f.write('YG_EXTERN_C_END\n')
|
||||||
|
|
||||||
# write out java files
|
# write out java files
|
||||||
for name, values in ENUMS.items():
|
for name, values in sorted(ENUMS.items()):
|
||||||
with open(root + '/java/com/facebook/yoga/Yoga%s.java' % name, 'w') as f:
|
with open(root + '/java/com/facebook/yoga/Yoga%s.java' % name, 'w') as f:
|
||||||
f.write(LICENSE)
|
f.write(LICENSE)
|
||||||
f.write('package com.facebook.yoga;\n\n')
|
f.write('package com.facebook.yoga;\n\n')
|
||||||
@@ -181,7 +185,7 @@ for name, values in ENUMS.items():
|
|||||||
f.write('}\n')
|
f.write('}\n')
|
||||||
|
|
||||||
# write out csharp files
|
# write out csharp files
|
||||||
for name, values in ENUMS.items():
|
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')
|
||||||
@@ -198,7 +202,7 @@ for name, values in ENUMS.items():
|
|||||||
with open(root + '/javascript/sources/YGEnums.js', 'w') as f:
|
with open(root + '/javascript/sources/YGEnums.js', 'w') as f:
|
||||||
f.write(LICENSE)
|
f.write(LICENSE)
|
||||||
f.write('module.exports = {\n\n')
|
f.write('module.exports = {\n\n')
|
||||||
for name, values in ENUMS.items():
|
for name, values in sorted(ENUMS.items()):
|
||||||
f.write(' %s_COUNT: %s,\n' % (to_java_upper(name), len(values)))
|
f.write(' %s_COUNT: %s,\n' % (to_java_upper(name), len(values)))
|
||||||
base = 0
|
base = 0
|
||||||
for value in values:
|
for value in values:
|
||||||
|
68
format.sh
@@ -1,34 +1,38 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
clang-format \
|
BASEDIR="$(dirname "$0")"
|
||||||
-style="{ \
|
FILES=$(find "$BASEDIR" \( -path "$BASEDIR/buck-out" -o -path "$BASEDIR/lib" \) -prune -o \
|
||||||
AlignAfterOpenBracket: Align, \
|
\( -name \*.h -o -name \*.c -o -name \*.cpp \) -print)
|
||||||
AlignEscapedNewlinesLeft: true, \
|
|
||||||
AlignOperands: true, \
|
for f in $FILES "$@"; do
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false, \
|
clang-format \
|
||||||
AllowShortBlocksOnASingleLine: false, \
|
-style="{ \
|
||||||
AllowShortCaseLabelsOnASingleLine: false, \
|
AlignAfterOpenBracket: Align, \
|
||||||
AllowShortFunctionsOnASingleLine: false, \
|
AlignEscapedNewlinesLeft: true, \
|
||||||
AllowShortIfStatementsOnASingleLine: false, \
|
AlignOperands: true, \
|
||||||
AllowShortLoopsOnASingleLine: false, \
|
AllowAllParametersOfDeclarationOnNextLine: false, \
|
||||||
BinPackArguments: false, \
|
AllowShortBlocksOnASingleLine: false, \
|
||||||
BinPackParameters: false, \
|
AllowShortCaseLabelsOnASingleLine: false, \
|
||||||
BreakBeforeBraces: Attach, \
|
AllowShortFunctionsOnASingleLine: false, \
|
||||||
ColumnLimit: 100, \
|
AllowShortIfStatementsOnASingleLine: false, \
|
||||||
ContinuationIndentWidth: 4, \
|
AllowShortLoopsOnASingleLine: false, \
|
||||||
IndentCaseLabels: true, \
|
BinPackArguments: false, \
|
||||||
IndentWidth: 2, \
|
BinPackParameters: false, \
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false, \
|
BreakBeforeBraces: Attach, \
|
||||||
Language: Cpp, \
|
ColumnLimit: 100, \
|
||||||
PenaltyBreakBeforeFirstCallParameter: 100, \
|
ContinuationIndentWidth: 4, \
|
||||||
PenaltyBreakString: 1000, \
|
IndentCaseLabels: true, \
|
||||||
PenaltyExcessCharacter: 100, \
|
IndentWidth: 2, \
|
||||||
PenaltyReturnTypeOnItsOwnLine: 100, \
|
KeepEmptyLinesAtTheStartOfBlocks: false, \
|
||||||
PointerAlignment: Right, \
|
Language: Cpp, \
|
||||||
SortIncludes: true, \
|
PenaltyBreakBeforeFirstCallParameter: 100, \
|
||||||
SpaceAfterCStyleCast: true, \
|
PenaltyBreakString: 1000, \
|
||||||
UseTab: Never, \
|
PenaltyExcessCharacter: 100, \
|
||||||
}" "$@" \
|
PenaltyReturnTypeOnItsOwnLine: 100, \
|
||||||
-i $(dirname $0)/yoga/*.{h,c,cpp} \
|
PointerAlignment: Right, \
|
||||||
$(dirname $0)/benchmarks/*.{h,c,cpp} \
|
SortIncludes: true, \
|
||||||
$(dirname $0)/java/jni/*.{h,c,cpp}
|
SpaceAfterCStyleCast: true, \
|
||||||
|
UseTab: Never, \
|
||||||
|
ObjCSpaceAfterProperty: true, \
|
||||||
|
}" -i "$f"
|
||||||
|
done
|
||||||
|
@@ -24,3 +24,39 @@
|
|||||||
<div style="position: absolute; width: 50px; height: 50px; left: 0px; top: 0px;"></div>
|
<div style="position: absolute; width: 50px; height: 50px; left: 0px; top: 0px;"></div>
|
||||||
<div style="position: absolute; width: 50px; height: 50px; right: 0px; bottom: 0px;"></div>
|
<div style="position: absolute; width: 50px; height: 50px; right: 0px; bottom: 0px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_center" style="height: 100px; width: 110px; flex-grow: 1; align-items: center; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_flex_end" style="height: 100px; width: 110px; flex-grow: 1; align-items: flex-end; justify-content: flex-end;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_justify_content_center" style="height: 100px; width: 110px; flex-grow: 1; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_center" style="height: 100px; width: 110px; flex-grow: 1; align-items: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_center_on_child_only" style="height: 100px; width: 110px; flex-grow: 1;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;align-self: center;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_center_and_top_position" style="height: 100px; width: 110px; flex-grow: 1; align-items: center; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;top:10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_center_and_bottom_position" style="height: 100px; width: 110px; flex-grow: 1; align-items: center; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;bottom:10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_center_and_left_position" style="height: 100px; width: 110px; flex-grow: 1; align-items: center; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;left:5px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="absolute_layout_align_items_and_justify_content_center_and_right_position" style="height: 100px; width: 110px; flex-grow: 1; align-items: center; justify-content: center;">
|
||||||
|
<div style="position: absolute; width: 60px; height: 40px;right:5px;"></div>
|
||||||
|
</div>
|
9
gentest/fixtures/YGDimensionTest.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div id="wrap_child">
|
||||||
|
<div style="width: 100px; height: 100px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="wrap_grandchild">
|
||||||
|
<div>
|
||||||
|
<div style="width: 100px; height: 100px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
27
gentest/fixtures/YGDisplayTest.html
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<div id="display_none" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex-grow: 1;"></div>
|
||||||
|
<div style="flex-grow: 1; display:none;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="display_none_fixed_size" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex-grow: 1;"></div>
|
||||||
|
<div style="width: 20px; height: 20px; display:none;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="display_none_with_margin" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="width: 20px; height: 20px; display:none; margin: 10px;"></div>
|
||||||
|
<div style="flex-grow: 1;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="display_none_with_child" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex: 1;"></div>
|
||||||
|
<div style="flex: 1; display:none;">
|
||||||
|
<div style="flex: 1; width: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
<div style="flex: 1;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="display_none_with_position" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex-grow: 1;"></div>
|
||||||
|
<div style="flex-grow: 1; display:none; top: 10px;"></div>
|
||||||
|
</div>
|
@@ -15,27 +15,27 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_and_flex_row" style="width: 100px; height: 100px; flex-direction: row;">
|
<div id="margin_and_flex_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
|
<div style="margin-start: 10px; margin-end: 10px; flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_and_flex_column" style="width: 100px; height: 100px;">
|
<div id="margin_and_flex_column" style="width: 100px; height: 100px;">
|
||||||
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
|
<div style="margin-top: 10px; margin-bottom: 10px; flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_and_stretch_row" style="width: 100px; height: 100px; flex-direction: row;">
|
<div id="margin_and_stretch_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
<div style="margin-top: 10px; margin-bottom; 10px; flex-grow: 1;"></div>
|
<div style="margin-top: 10px; margin-bottom: 10px; flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_and_stretch_column" style="width: 100px; height: 100px;">
|
<div id="margin_and_stretch_column" style="width: 100px; height: 100px;">
|
||||||
<div style="margin-start: 10px; margin-end; 10px; flex-grow: 1;"></div>
|
<div style="margin-start: 10px; margin-end: 10px; flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_with_sibling_row" style="width: 100px; height: 100px; flex-direction: row;">
|
<div id="margin_with_sibling_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
<div style="margin-end; 10px; flex-grow: 1;"></div>
|
<div style="margin-end: 10px; flex-grow: 1;"></div>
|
||||||
<div style="flex-grow: 1;"></div>
|
<div style="flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="margin_with_sibling_column" style="width: 100px; height: 100px;">
|
<div id="margin_with_sibling_column" style="width: 100px; height: 100px;">
|
||||||
<div style="margin-bottom; 10px; flex-grow: 1;"></div>
|
<div style="margin-bottom: 10px; flex-grow: 1;"></div>
|
||||||
<div style="flex-grow: 1;"></div>
|
<div style="flex-grow: 1;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -79,3 +79,7 @@
|
|||||||
<div id="percentage_absolute_position" experiments="Rounding" style="width: 200px; height: 100px;">
|
<div id="percentage_absolute_position" experiments="Rounding" style="width: 200px; height: 100px;">
|
||||||
<div style="position: absolute; top: 10%; left: 30%; width: 10px; height: 10px;"></div>
|
<div style="position: absolute; top: 10%; left: 30%; width: 10px; height: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="percentage_width_height_undefined_parent_size">
|
||||||
|
<div style="width: 50%; height: 50%;"></div>
|
||||||
|
</div>
|
||||||
|
@@ -28,8 +28,8 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
emitPrologue:{value:function() {
|
emitPrologue:{value:function() {
|
||||||
this.push([
|
this.push([
|
||||||
'#include <yoga/Yoga.h>',
|
|
||||||
'#include <gtest/gtest.h>',
|
'#include <gtest/gtest.h>',
|
||||||
|
'#include <yoga/Yoga.h>',
|
||||||
'',
|
'',
|
||||||
]);
|
]);
|
||||||
}},
|
}},
|
||||||
@@ -118,6 +118,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGUndefined:{value:'YGUndefined'},
|
YGUndefined:{value:'YGUndefined'},
|
||||||
|
|
||||||
|
YGDisplayFlex:{value:'YGDisplayFlex'},
|
||||||
|
YGDisplayNone:{value:'YGDisplayNone'},
|
||||||
|
|
||||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||||
this.push('YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');');
|
this.push('YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');');
|
||||||
}},
|
}},
|
||||||
@@ -162,6 +165,10 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
this.push('YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');');
|
this.push('YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||||
|
this.push('YGNodeStyleSetDisplay(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||||
|
}},
|
||||||
|
|
||||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||||
this.push('YGNodeStyleSetFlexBasis' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');');
|
this.push('YGNodeStyleSetFlexBasis' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||||
}},
|
}},
|
||||||
|
@@ -128,6 +128,9 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGUndefined:{value:'YogaConstants.Undefined'},
|
YGUndefined:{value:'YogaConstants.Undefined'},
|
||||||
|
|
||||||
|
YGDisplayFlex:{value:'YogaDisplay.Flex'},
|
||||||
|
YGDisplayNone:{value:'YogaDisplay.None'},
|
||||||
|
|
||||||
YGWrapNoWrap:{value:'YogaWrap.NoWrap'},
|
YGWrapNoWrap:{value:'YogaWrap.NoWrap'},
|
||||||
YGWrapWrap:{value:'YogaWrap.Wrap'},
|
YGWrapWrap:{value:'YogaWrap.Wrap'},
|
||||||
|
|
||||||
@@ -176,6 +179,10 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
this.push(nodeName + '.StyleDirection = ' + toValueCs(value) + ';');
|
this.push(nodeName + '.StyleDirection = ' + toValueCs(value) + ';');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||||
|
this.push(nodeName + '.Display = ' + toValueCs(value) + ';');
|
||||||
|
}},
|
||||||
|
|
||||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||||
this.push(nodeName + '.FlexBasis = ' + toCsUnitValue(value) + ';');
|
this.push(nodeName + '.FlexBasis = ' + toCsUnitValue(value) + ';');
|
||||||
}},
|
}},
|
||||||
|
@@ -132,12 +132,15 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGUndefined:{value:'YogaConstants.UNDEFINED'},
|
YGUndefined:{value:'YogaConstants.UNDEFINED'},
|
||||||
|
|
||||||
|
YGDisplayFlex:{value:'YogaDisplay.FLEX'},
|
||||||
|
YGDisplayNone:{value:'YogaDisplay.NONE'},
|
||||||
|
|
||||||
YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'},
|
YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'},
|
||||||
YGWrapWrap:{value:'YogaWrap.WRAP'},
|
YGWrapWrap:{value:'YogaWrap.WRAP'},
|
||||||
|
|
||||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||||
this.push(node + '.setDirection(' + dir + ');');
|
this.push(node + '.setDirection(' + dir + ');');
|
||||||
this.push(node + '.calculateLayout();');
|
this.push(node + '.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
YGNodeInsertChild:{value:function(parentName, nodeName, index) {
|
YGNodeInsertChild:{value:function(parentName, nodeName, index) {
|
||||||
@@ -180,6 +183,10 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
this.push(nodeName + '.setDirection(' + toValueJava(value) + ');');
|
this.push(nodeName + '.setDirection(' + toValueJava(value) + ');');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||||
|
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||||
|
}},
|
||||||
|
|
||||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||||
this.push(nodeName + '.setFlexBasis' + toMethodName(value) + '(' + toValueJava(value) + 'f);');
|
this.push(nodeName + '.setFlexBasis' + toMethodName(value) + '(' + toValueJava(value) + 'f);');
|
||||||
}},
|
}},
|
||||||
|
@@ -125,6 +125,9 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGUndefined:{value:'Yoga.UNDEFINED'},
|
YGUndefined:{value:'Yoga.UNDEFINED'},
|
||||||
|
|
||||||
|
YGDisplayFlex:{value:'Yoga.DISPLAY_FLEX'},
|
||||||
|
YGDisplayNone:{value:'Yoga.DISPLAY_NONE'},
|
||||||
|
|
||||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||||
this.push(node + '.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, ' + dir + ');');
|
this.push(node + '.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, ' + dir + ');');
|
||||||
}},
|
}},
|
||||||
@@ -169,6 +172,10 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
this.push(nodeName + '.setDirection(' + toValueJavascript(value) + ');');
|
this.push(nodeName + '.setDirection(' + toValueJavascript(value) + ');');
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||||
|
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||||
|
}},
|
||||||
|
|
||||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||||
this.push(nodeName + '.setFlexBasis(' + toValueJavascript(value) + ');');
|
this.push(nodeName + '.setFlexBasis(' + toValueJavascript(value) + ');');
|
||||||
}},
|
}},
|
||||||
|
@@ -52,7 +52,7 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
|
|||||||
' * of patent rights can be found in the PATENTS file in the same directory.',
|
' * of patent rights can be found in the PATENTS file in the same directory.',
|
||||||
' */',
|
' */',
|
||||||
'',
|
'',
|
||||||
' // @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
|
'// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
|
||||||
'',
|
'',
|
||||||
]);
|
]);
|
||||||
e.emitPrologue();
|
e.emitPrologue();
|
||||||
@@ -140,6 +140,7 @@ function checkDefaultValues() {
|
|||||||
{style:'top', value:'undefined'},
|
{style:'top', value:'undefined'},
|
||||||
{style:'right', value:'undefined'},
|
{style:'right', value:'undefined'},
|
||||||
{style:'bottom', value:'undefined'},
|
{style:'bottom', value:'undefined'},
|
||||||
|
{style:'display', value:'flex'},
|
||||||
].forEach(function(item) {
|
].forEach(function(item) {
|
||||||
assert(item.value === getDefaultStyleValue(item.style),
|
assert(item.value === getDefaultStyleValue(item.style),
|
||||||
item.style + ' should be ' + item.value);
|
item.style + ' should be ' + item.value);
|
||||||
@@ -300,6 +301,9 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
|
|||||||
case 'max-height':
|
case 'max-height':
|
||||||
e.YGNodeStyleSetMaxHeight(nodeName, pixelValue(e, node.style[style]));
|
e.YGNodeStyleSetMaxHeight(nodeName, pixelValue(e, node.style[style]));
|
||||||
break;
|
break;
|
||||||
|
case 'display':
|
||||||
|
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,6 +393,13 @@ function pixelValue(e, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayValue(e, value){
|
||||||
|
switch(value){
|
||||||
|
case 'flex': return e.YGDisplayFlex;
|
||||||
|
case 'none': return e.YGDisplayNone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getDefaultStyleValue(style) {
|
function getDefaultStyleValue(style) {
|
||||||
if (style == 'position') {
|
if (style == 'position') {
|
||||||
return 'relative';
|
return 'relative';
|
||||||
@@ -466,6 +477,7 @@ function getYogaStyle(node) {
|
|||||||
'height',
|
'height',
|
||||||
'min-height',
|
'min-height',
|
||||||
'max-height',
|
'max-height',
|
||||||
|
'display',
|
||||||
].reduce(function(map, key) {
|
].reduce(function(map, key) {
|
||||||
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||||
return map;
|
return map;
|
||||||
|
36
java/com/facebook/yoga/YogaDisplay.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public enum YogaDisplay {
|
||||||
|
FLEX(0),
|
||||||
|
NONE(1);
|
||||||
|
|
||||||
|
private int mIntValue;
|
||||||
|
|
||||||
|
YogaDisplay(int intValue) {
|
||||||
|
mIntValue = intValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int intValue() {
|
||||||
|
return mIntValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YogaDisplay fromInt(int value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0: return FLEX;
|
||||||
|
case 1: return NONE;
|
||||||
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -172,10 +172,10 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
return mChildren == null ? -1 : mChildren.indexOf(child);
|
return mChildren == null ? -1 : mChildren.indexOf(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeCalculateLayout(long nativePointer);
|
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||||
@Override
|
@Override
|
||||||
public void calculateLayout() {
|
public void calculateLayout(float width, float height) {
|
||||||
jni_YGNodeCalculateLayout(mNativePointer);
|
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
||||||
@@ -211,7 +211,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaDirection getStyleDirection() {
|
public YogaDirection getStyleDirection() {
|
||||||
return YogaDirection.values()[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);
|
||||||
@@ -223,7 +223,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
private native int jni_YGNodeStyleGetFlexDirection(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaFlexDirection getFlexDirection() {
|
public YogaFlexDirection getFlexDirection() {
|
||||||
return YogaFlexDirection.values()[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);
|
||||||
@@ -235,7 +235,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
private native int jni_YGNodeStyleGetJustifyContent(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaJustify getJustifyContent() {
|
public YogaJustify getJustifyContent() {
|
||||||
return YogaJustify.values()[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);
|
||||||
@@ -247,7 +247,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignItems(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaAlign getAlignItems() {
|
public YogaAlign getAlignItems() {
|
||||||
return YogaAlign.values()[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);
|
||||||
@@ -259,7 +259,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignSelf(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaAlign getAlignSelf() {
|
public YogaAlign getAlignSelf() {
|
||||||
return YogaAlign.values()[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);
|
||||||
@@ -271,7 +271,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
private native int jni_YGNodeStyleGetAlignContent(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaAlign getAlignContent() {
|
public YogaAlign getAlignContent() {
|
||||||
return YogaAlign.values()[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);
|
||||||
@@ -283,7 +283,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
private native int jni_YGNodeStyleGetPositionType(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaPositionType getPositionType() {
|
public YogaPositionType getPositionType() {
|
||||||
return YogaPositionType.values()[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);
|
||||||
@@ -301,7 +301,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
private native int jni_YGNodeStyleGetOverflow(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public YogaOverflow getOverflow() {
|
public YogaOverflow getOverflow() {
|
||||||
return YogaOverflow.values()[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);
|
||||||
@@ -310,6 +310,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
jni_YGNodeStyleSetOverflow(mNativePointer, overflow.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int jni_YGNodeStyleGetDisplay(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaDisplay getDisplay() {
|
||||||
|
return YogaDisplay.fromInt(jni_YGNodeStyleGetDisplay(mNativePointer));
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetDisplay(long nativePointer, int display);
|
||||||
|
@Override
|
||||||
|
public void setDisplay(YogaDisplay display) {
|
||||||
|
jni_YGNodeStyleSetDisplay(mNativePointer, display.intValue());
|
||||||
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
private native void jni_YGNodeStyleSetFlex(long nativePointer, float flex);
|
||||||
@Override
|
@Override
|
||||||
public void setFlex(float flex) {
|
public void setFlex(float flex) {
|
||||||
@@ -623,7 +635,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public YogaDirection getLayoutDirection() {
|
public YogaDirection getLayoutDirection() {
|
||||||
return YogaDirection.values()[mLayoutDirection];
|
return YogaDirection.fromInt(mLayoutDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
@@ -647,9 +659,9 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
return mMeasureFunction.measure(
|
return mMeasureFunction.measure(
|
||||||
this,
|
this,
|
||||||
width,
|
width,
|
||||||
YogaMeasureMode.values()[widthMode],
|
YogaMeasureMode.fromInt(widthMode),
|
||||||
height,
|
height,
|
||||||
YogaMeasureMode.values()[heightMode]);
|
YogaMeasureMode.fromInt(heightMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||||
|
@@ -20,7 +20,7 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
|||||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||||
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
void setBaselineFunction(YogaBaselineFunction measureFunction);
|
||||||
boolean isMeasureDefined();
|
boolean isMeasureDefined();
|
||||||
void calculateLayout();
|
void calculateLayout(float width, float height);
|
||||||
boolean isDirty();
|
boolean isDirty();
|
||||||
boolean hasNewLayout();
|
boolean hasNewLayout();
|
||||||
void dirty();
|
void dirty();
|
||||||
@@ -87,6 +87,8 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
|||||||
YogaDirection getLayoutDirection();
|
YogaDirection getLayoutDirection();
|
||||||
YogaOverflow getOverflow();
|
YogaOverflow getOverflow();
|
||||||
void setOverflow(YogaOverflow overflow);
|
void setOverflow(YogaOverflow overflow);
|
||||||
|
YogaDisplay getDisplay();
|
||||||
|
void setDisplay(YogaDisplay display);
|
||||||
void setData(Object data);
|
void setData(Object data);
|
||||||
Object getData();
|
Object getData();
|
||||||
void reset();
|
void reset();
|
||||||
|
@@ -75,7 +75,9 @@ static void YGPrint(YGNodeRef node) {
|
|||||||
|
|
||||||
static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) {
|
static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) {
|
||||||
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
||||||
return findClassLocal("com/facebook/yoga/YogaNode")->getMethod<jfloat(jfloat, jfloat)>("baseline")(obj, width, height);
|
static auto baselineFunc = findClassStatic("com/facebook/yoga/YogaNode")
|
||||||
|
->getMethod<jfloat(jfloat, jfloat)>("baseline");
|
||||||
|
return baselineFunc(obj, width, height);
|
||||||
} else {
|
} else {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,7 @@ static YGSize YGJNIMeasureFunc(YGNodeRef node,
|
|||||||
float height,
|
float height,
|
||||||
YGMeasureMode heightMode) {
|
YGMeasureMode heightMode) {
|
||||||
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
||||||
static auto measureFunc = findClassLocal("com/facebook/yoga/YogaNode")
|
static auto measureFunc = findClassStatic("com/facebook/yoga/YogaNode")
|
||||||
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
|
||||||
|
|
||||||
YGTransferLayoutDirection(node, obj);
|
YGTransferLayoutDirection(node, obj);
|
||||||
@@ -121,7 +123,7 @@ static int YGLog(YGLogLevel level, const char *format, va_list args) {
|
|||||||
char buffer[256];
|
char buffer[256];
|
||||||
int result = vsnprintf(buffer, sizeof(buffer), format, args);
|
int result = vsnprintf(buffer, sizeof(buffer), format, args);
|
||||||
|
|
||||||
static auto logFunc = findClassLocal("com/facebook/yoga/YogaLogger")
|
static auto logFunc = findClassStatic("com/facebook/yoga/YogaLogger")
|
||||||
->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log");
|
->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log");
|
||||||
|
|
||||||
static auto logLevelFromInt =
|
static auto logLevelFromInt =
|
||||||
@@ -200,11 +202,14 @@ void jni_YGNodeRemoveChild(alias_ref<jobject>, jlong nativePointer, jlong childP
|
|||||||
YGNodeRemoveChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
YGNodeRemoveChild(_jlong2YGNodeRef(nativePointer), _jlong2YGNodeRef(childPointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
void jni_YGNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer) {
|
void jni_YGNodeCalculateLayout(alias_ref<jobject>,
|
||||||
|
jlong nativePointer,
|
||||||
|
jfloat width,
|
||||||
|
jfloat height) {
|
||||||
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
const YGNodeRef root = _jlong2YGNodeRef(nativePointer);
|
||||||
YGNodeCalculateLayout(root,
|
YGNodeCalculateLayout(root,
|
||||||
YGUndefined,
|
static_cast<float>(width),
|
||||||
YGUndefined,
|
static_cast<float>(height),
|
||||||
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)));
|
||||||
YGTransferLayoutOutputsRecursive(root);
|
YGTransferLayoutOutputsRecursive(root);
|
||||||
}
|
}
|
||||||
@@ -221,8 +226,11 @@ void jni_YGNodeSetHasMeasureFunc(alias_ref<jobject>, jlong nativePointer, jboole
|
|||||||
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>, jlong nativePointer, jboolean hasBaselineFunc) {
|
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>,
|
||||||
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer), hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
jlong nativePointer,
|
||||||
|
jboolean hasBaselineFunc) {
|
||||||
|
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer),
|
||||||
|
hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
||||||
@@ -314,6 +322,7 @@ YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent);
|
|||||||
YG_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
|
YG_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
|
||||||
YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
|
YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
|
||||||
YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
|
YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
|
||||||
|
YG_NODE_JNI_STYLE_PROP(jint, YGDisplay, Display);
|
||||||
|
|
||||||
void jni_YGNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) {
|
void jni_YGNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) {
|
||||||
YGNodeStyleSetFlex(_jlong2YGNodeRef(nativePointer), static_cast<float>(value));
|
YGNodeStyleSetFlex(_jlong2YGNodeRef(nativePointer), static_cast<float>(value));
|
||||||
@@ -373,6 +382,8 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeStyleSetFlexWrap),
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlexWrap),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetOverflow),
|
YGMakeNativeMethod(jni_YGNodeStyleGetOverflow),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetOverflow),
|
YGMakeNativeMethod(jni_YGNodeStyleSetOverflow),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleGetDisplay),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetDisplay),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetFlex),
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlex),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetFlexGrow),
|
YGMakeNativeMethod(jni_YGNodeStyleGetFlexGrow),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetFlexGrow),
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlexGrow),
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -43,7 +43,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -70,7 +70,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -83,7 +83,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -110,7 +110,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child0.setPosition(YogaEdge.BOTTOM, 10f);
|
root_child0.setPosition(YogaEdge.BOTTOM, 10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -123,7 +123,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -152,7 +152,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -165,7 +165,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -197,7 +197,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child0_child0.setHeight(100f);
|
root_child0_child0.setHeight(100f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -215,7 +215,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -267,7 +267,7 @@ public class YGAbsolutePositionTest {
|
|||||||
root_child1.setHeight(50f);
|
root_child1.setHeight(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||||
@@ -285,7 +285,7 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||||
@@ -303,4 +303,374 @@ public class YGAbsolutePositionTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_center() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_flex_end() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.FLEX_END);
|
||||||
|
root.setAlignItems(YogaAlign.FLEX_END);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_justify_content_center() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_center() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_center_on_child_only() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setAlignSelf(YogaAlign.CENTER);
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_center_and_top_position() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPosition(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_center_and_bottom_position() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPosition(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_center_and_left_position() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPosition(YogaEdge.LEFT, 5f);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(5f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(5f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_absolute_layout_align_items_and_justify_content_center_and_right_position() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setFlexGrow(1f);
|
||||||
|
root.setWidth(110f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPosition(YogaEdge.RIGHT, 5f);
|
||||||
|
root_child0.setWidth(60f);
|
||||||
|
root_child0.setHeight(40f);
|
||||||
|
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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, 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(110f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(45f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class YGAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -81,7 +81,7 @@ public class YGAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class YGAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -180,7 +180,7 @@ public class YGAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -246,7 +246,7 @@ public class YGAlignContentTest {
|
|||||||
root_child4.setHeight(10f);
|
root_child4.setHeight(10f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -279,7 +279,7 @@ public class YGAlignContentTest {
|
|||||||
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -340,7 +340,7 @@ public class YGAlignContentTest {
|
|||||||
root_child4.setWidth(50f);
|
root_child4.setWidth(50f);
|
||||||
root.addChildAt(root_child4, 4);
|
root.addChildAt(root_child4, 4);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -373,7 +373,7 @@ public class YGAlignContentTest {
|
|||||||
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -39,7 +39,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -64,7 +64,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -77,7 +77,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -102,7 +102,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -115,7 +115,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -140,7 +140,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -153,7 +153,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -184,7 +184,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1.setHeight(20f);
|
root_child1.setHeight(20f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -202,7 +202,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -243,7 +243,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -266,7 +266,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -329,7 +329,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child3.setHeight(10f);
|
root_child1_child3.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child3, 3);
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -367,7 +367,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -447,7 +447,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child3.setHeight(10f);
|
root_child1_child3.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child3, 3);
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -485,7 +485,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -564,7 +564,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child3.setHeight(10f);
|
root_child1_child3.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child3, 3);
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -602,7 +602,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -664,7 +664,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -687,7 +687,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -734,7 +734,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -757,7 +757,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -808,7 +808,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(15f);
|
root_child1_child0.setHeight(15f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -836,7 +836,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(15f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -881,7 +881,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1.setHeight(20f);
|
root_child1.setHeight(20f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -899,7 +899,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -948,7 +948,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -971,7 +971,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1025,7 +1025,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1048,7 +1048,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1110,7 +1110,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child3.setHeight(50f);
|
root_child3.setHeight(50f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1148,7 +1148,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1224,7 +1224,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child3.setHeight(20f);
|
root_child3.setHeight(20f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1262,7 +1262,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1338,7 +1338,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child3.setHeight(20f);
|
root_child3.setHeight(20f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1376,7 +1376,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1453,7 +1453,7 @@ public class YGAlignItemsTest {
|
|||||||
root_child3.setHeight(20f);
|
root_child3.setHeight(20f);
|
||||||
root.addChildAt(root_child3, 3);
|
root.addChildAt(root_child3, 3);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -1491,7 +1491,7 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ public class YGAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -41,7 +41,7 @@ public class YGAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -66,7 +66,7 @@ public class YGAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -79,7 +79,7 @@ public class YGAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -104,7 +104,7 @@ public class YGAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -117,7 +117,7 @@ public class YGAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -143,7 +143,7 @@ public class YGAlignSelfTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -156,7 +156,7 @@ public class YGAlignSelfTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -193,7 +193,7 @@ public class YGAlignSelfTest {
|
|||||||
root_child1_child0.setHeight(10f);
|
root_child1_child0.setHeight(10f);
|
||||||
root_child1.addChildAt(root_child1_child0, 0);
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -216,7 +216,7 @@ public class YGAlignSelfTest {
|
|||||||
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class YGBorderTest {
|
|||||||
root.setBorder(YogaEdge.RIGHT, 10f);
|
root.setBorder(YogaEdge.RIGHT, 10f);
|
||||||
root.setBorder(YogaEdge.BOTTOM, 10f);
|
root.setBorder(YogaEdge.BOTTOM, 10f);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -32,7 +32,7 @@ public class YGBorderTest {
|
|||||||
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -53,7 +53,7 @@ public class YGBorderTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -66,7 +66,7 @@ public class YGBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -94,7 +94,7 @@ public class YGBorderTest {
|
|||||||
root_child0.setWidth(10f);
|
root_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -107,7 +107,7 @@ public class YGBorderTest {
|
|||||||
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -134,7 +134,7 @@ public class YGBorderTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -147,7 +147,7 @@ public class YGBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -176,7 +176,7 @@ public class YGBorderTest {
|
|||||||
root_child0.setHeight(10f);
|
root_child0.setHeight(10f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -189,7 +189,7 @@ public class YGBorderTest {
|
|||||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
102
java/tests/com/facebook/yoga/YGDimensionTest.java
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class YGDimensionTest {
|
||||||
|
@Test
|
||||||
|
public void test_wrap_child() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
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(100f, 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(100f, 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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_wrap_grandchild() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = new YogaNode();
|
||||||
|
root_child0_child0.setWidth(100f);
|
||||||
|
root_child0_child0.setHeight(100f);
|
||||||
|
root_child0.addChildAt(root_child0_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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
325
java/tests/com/facebook/yoga/YGDisplayTest.java
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class YGDisplayTest {
|
||||||
|
@Test
|
||||||
|
public void test_display_none() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setDisplay(YogaDisplay.NONE);
|
||||||
|
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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, 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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_display_none_fixed_size() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.setWidth(20f);
|
||||||
|
root_child1.setHeight(20f);
|
||||||
|
root_child1.setDisplay(YogaDisplay.NONE);
|
||||||
|
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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, 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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_display_none_with_margin() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setMargin(YogaEdge.LEFT, 10f);
|
||||||
|
root_child0.setMargin(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setMargin(YogaEdge.RIGHT, 10f);
|
||||||
|
root_child0.setMargin(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setWidth(20f);
|
||||||
|
root_child0.setHeight(20f);
|
||||||
|
root_child0.setDisplay(YogaDisplay.NONE);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
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(100f, 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(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, 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(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_display_none_with_child() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root_child0.setFlexShrink(1f);
|
||||||
|
root_child0.setFlexBasisPercent(0f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setFlexShrink(1f);
|
||||||
|
root_child1.setFlexBasisPercent(0f);
|
||||||
|
root_child1.setDisplay(YogaDisplay.NONE);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = new YogaNode();
|
||||||
|
root_child1_child0.setFlexGrow(1f);
|
||||||
|
root_child1_child0.setFlexShrink(1f);
|
||||||
|
root_child1_child0.setFlexBasisPercent(0f);
|
||||||
|
root_child1_child0.setWidth(20f);
|
||||||
|
root_child1_child0.setMinWidth(0f);
|
||||||
|
root_child1_child0.setMinHeight(0f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = new YogaNode();
|
||||||
|
root_child2.setFlexGrow(1f);
|
||||||
|
root_child2.setFlexShrink(1f);
|
||||||
|
root_child2.setFlexBasisPercent(0f);
|
||||||
|
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(100f, 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(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_display_none_with_position() {
|
||||||
|
final YogaNode root = new YogaNode();
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode();
|
||||||
|
root_child0.setFlexGrow(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = new YogaNode();
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setPosition(YogaEdge.TOP, 10f);
|
||||||
|
root_child1.setDisplay(YogaDisplay.NONE);
|
||||||
|
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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, 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(100f, 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(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -56,7 +56,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -97,7 +97,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -120,7 +120,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -161,7 +161,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -184,7 +184,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -226,7 +226,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -249,7 +249,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -291,7 +291,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -314,7 +314,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -356,7 +356,7 @@ public class YGFlexDirectionTest {
|
|||||||
root_child2.setWidth(10f);
|
root_child2.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -379,7 +379,7 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public class YGFlexTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -49,7 +49,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -83,7 +83,7 @@ public class YGFlexTest {
|
|||||||
root_child1.setFlexGrow(1f);
|
root_child1.setFlexGrow(1f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -101,7 +101,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -134,7 +134,7 @@ public class YGFlexTest {
|
|||||||
root_child1.setFlexBasis(50f);
|
root_child1.setFlexBasis(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -152,7 +152,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -186,7 +186,7 @@ public class YGFlexTest {
|
|||||||
root_child1.setFlexBasis(50f);
|
root_child1.setFlexBasis(50f);
|
||||||
root.addChildAt(root_child1, 1);
|
root.addChildAt(root_child1, 1);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -204,7 +204,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -243,7 +243,7 @@ public class YGFlexTest {
|
|||||||
root_child2.setHeight(50f);
|
root_child2.setHeight(50f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -266,7 +266,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -311,7 +311,7 @@ public class YGFlexTest {
|
|||||||
root_child2.setHeight(10f);
|
root_child2.setHeight(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root.addChildAt(root_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -334,7 +334,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -371,7 +371,7 @@ public class YGFlexTest {
|
|||||||
root_child0_child0.setFlexShrink(1f);
|
root_child0_child0.setFlexShrink(1f);
|
||||||
root_child0.addChildAt(root_child0_child0, 0);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
@@ -389,7 +389,7 @@ public class YGFlexTest {
|
|||||||
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout();
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|