Compare commits
50 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 | ||
|
8d74e01f41 | ||
|
5404bb13d4 | ||
|
be8773fee0 | ||
|
0bcec80dfe | ||
|
2c8c2bffda |
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.
|
||||
|
||||
os: osx
|
||||
osx_image: xcode7.3
|
||||
osx_image: xcode8.2
|
||||
language: cpp
|
||||
compiler: clang
|
||||
|
||||
@@ -29,7 +29,7 @@ install:
|
||||
script:
|
||||
- buck test //:yoga
|
||||
- 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
|
||||
|
||||
- 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
|
||||
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.
|
||||
@@ -27,4 +27,4 @@ You may need to install the latest watir-webdriver gem (`gem install watir-webdr
|
||||
For the main C implementation of Yoga clang-format is used to ensure a consistent code style. Please run `bash format.sh` before submitting a pull request. For other languages just try to follow the current code style.
|
||||
|
||||
## Benchmarks
|
||||
Benchmarks are located in `benchmarks/YGBenchmark.c` and can be run with `buck run //benchmarks:benchmarks`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.
|
||||
Benchmarks are located in `benchmark/YGBenchmark.c` and can be run with `buck run //benchmark:benchmark`. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.
|
||||
|
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(
|
||||
name = 'YogaKit',
|
||||
compiler_flags = COMPILER_FLAGS,
|
||||
srcs = glob(['*.m']),
|
||||
exported_headers = glob(['*.h']),
|
||||
srcs = glob(['Source/**/*.m']),
|
||||
exported_headers = glob(['Source/**/*.h']),
|
||||
frameworks = [
|
||||
'$SDKROOT/System/Library/Frameworks/Foundation.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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "YGLayout.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIView (Yoga)
|
||||
|
@@ -8,8 +8,11 @@
|
||||
*/
|
||||
|
||||
#import "YGLayout.h"
|
||||
#import <yoga/Yoga.h>
|
||||
|
||||
@interface YGLayout (Private)
|
||||
@interface YGLayout ()
|
||||
|
||||
@property (nonatomic, assign, readonly) YGNodeRef node;
|
||||
|
||||
- (instancetype)initWithView:(UIView *)view;
|
||||
|
@@ -18,7 +18,8 @@
|
||||
@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;
|
||||
|
||||
@@ -31,6 +32,7 @@
|
||||
@property (nonatomic, readwrite, assign) YGPositionType position;
|
||||
@property (nonatomic, readwrite, assign) YGWrap flexWrap;
|
||||
@property (nonatomic, readwrite, assign) YGOverflow overflow;
|
||||
@property (nonatomic, readwrite, assign) YGDisplay display;
|
||||
|
||||
@property (nonatomic, readwrite, assign) CGFloat flexGrow;
|
||||
@property (nonatomic, readwrite, assign) CGFloat flexShrink;
|
||||
@@ -84,7 +86,7 @@
|
||||
/**
|
||||
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
|
||||
@@ -92,19 +94,21 @@
|
||||
- (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.
|
||||
*/
|
||||
@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.
|
@@ -9,75 +9,99 @@
|
||||
|
||||
#import "YGLayout+Private.h"
|
||||
#import "UIView+Yoga.h"
|
||||
#import <yoga/Yoga.h>
|
||||
|
||||
#define YG_STYLE_PROPERTY_IMPL(type, lowercased_name, capitalized_name) \
|
||||
- (type)lowercased_name \
|
||||
{ \
|
||||
return YGNodeStyleGet##capitalized_name(self.node); \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(type)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
#define YG_PROPERTY(type, lowercased_name, capitalized_name) \
|
||||
- (type)lowercased_name \
|
||||
{ \
|
||||
return YGNodeStyleGet##capitalized_name(self.node); \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(type)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_EDGE_PROPERTY_IMPL(lowercased_name, capitalized_name, property, edge) \
|
||||
- (CGFloat)lowercased_name { \
|
||||
return YGNodeStyleGet##property(self.node, edge); \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name { \
|
||||
YGNodeStyleSet##property(self.node, edge, lowercased_name); \
|
||||
#define YG_VALUE_PROPERTY(lowercased_name, capitalized_name) \
|
||||
- (CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##capitalized_name(self.node); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_VALUE_PROPERTY_IMPL(lowercased_name, capitalized_name) \
|
||||
- (CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##capitalized_name(self.node); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, lowercased_name); \
|
||||
#define YG_EDGE_PROPERTY_GETTER(lowercased_name, capitalized_name, property, edge) \
|
||||
- (CGFloat)lowercased_name \
|
||||
{ \
|
||||
return YGNodeStyleGet##property(self.node, edge); \
|
||||
}
|
||||
|
||||
#define YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, edge, edge_suffix) \
|
||||
- (CGFloat)lowercased_name##edge_suffix \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##capitalized_name(self.node, edge); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
- (void)set##capitalized_name##edge_suffix:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##capitalized_name(self.node, edge, lowercased_name); \
|
||||
#define YG_SHORTHAND_EDGE_PROPERTY_GETTER(lowercased_name) \
|
||||
- (CGFloat)lowercased_name \
|
||||
{ \
|
||||
return YGUndefined; \
|
||||
}
|
||||
|
||||
#define YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeLeft, Left) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeTop, Top) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeRight, Right) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeBottom, Bottom) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeStart, Start) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeEnd, End) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeHorizontal, Horizontal) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeVertical, Vertical) \
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeAll, )
|
||||
#define YG_EDGE_PROPERTY_SETTER(lowercased_name, capitalized_name, property, edge) \
|
||||
- (void)set##capitalized_name:(CGFloat)lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##property(self.node, edge, lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_EDGE_PROPERTY(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_EDGE_PROPERTY_GETTER(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_EDGE_PROPERTY_SETTER(lowercased_name, capitalized_name, property, edge)
|
||||
|
||||
#define YG_SHORTHAND_EDGE_PROPERTY(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_SHORTHAND_EDGE_PROPERTY_GETTER(lowercased_name) \
|
||||
YG_EDGE_PROPERTY_SETTER(lowercased_name, capitalized_name, property, edge)
|
||||
|
||||
#define YG_VALUE_EDGE_PROPERTY_GETTER(objc_lowercased_name, objc_capitalized_name, c_name, edge) \
|
||||
- (CGFloat)objc_lowercased_name \
|
||||
{ \
|
||||
YGValue value = YGNodeStyleGet##c_name(self.node, edge); \
|
||||
if (value.unit == YGUnitPixel) { \
|
||||
return value.value; \
|
||||
} else { \
|
||||
return YGUndefined; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YG_VALUE_EDGE_PROPERTY_SETTER(objc_lowercased_name, objc_capitalized_name, c_name, edge) \
|
||||
- (void)set##objc_capitalized_name:(CGFloat)objc_lowercased_name \
|
||||
{ \
|
||||
YGNodeStyleSet##c_name(self.node, edge, objc_lowercased_name); \
|
||||
}
|
||||
|
||||
#define YG_VALUE_EDGE_PROPERTY(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_VALUE_EDGE_PROPERTY_GETTER(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_VALUE_EDGE_PROPERTY_SETTER(lowercased_name, capitalized_name, property, edge)
|
||||
|
||||
#define YG_VALUE_SHORTHAND_EDGE_PROPERTY(lowercased_name, capitalized_name, property, edge) \
|
||||
YG_SHORTHAND_EDGE_PROPERTY_GETTER(lowercased_name) \
|
||||
YG_VALUE_EDGE_PROPERTY_SETTER(lowercased_name, capitalized_name, property, edge)
|
||||
|
||||
#define YG_VALUE_EDGES_PROPERTIES(lowercased_name, capitalized_name) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##Left, capitalized_name##Left, capitalized_name, YGEdgeLeft) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##Top, capitalized_name##Top, capitalized_name, YGEdgeTop) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##Right, capitalized_name##Right, capitalized_name, YGEdgeRight) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##Bottom, capitalized_name##Bottom, capitalized_name, YGEdgeBottom) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##Start, capitalized_name##Start, capitalized_name, YGEdgeStart) \
|
||||
YG_VALUE_EDGE_PROPERTY(lowercased_name##End, capitalized_name##End, capitalized_name, YGEdgeEnd) \
|
||||
YG_VALUE_SHORTHAND_EDGE_PROPERTY(lowercased_name##Horizontal, capitalized_name##Horizontal, capitalized_name, YGEdgeHorizontal) \
|
||||
YG_VALUE_SHORTHAND_EDGE_PROPERTY(lowercased_name##Vertical, capitalized_name##Vertical, capitalized_name, YGEdgeVertical) \
|
||||
YG_VALUE_SHORTHAND_EDGE_PROPERTY(lowercased_name, capitalized_name, capitalized_name, YGEdgeAll)
|
||||
|
||||
@interface YGLayout ()
|
||||
|
||||
@property (nonatomic, weak, readonly) UIView *view;
|
||||
@property (nonatomic, assign, readonly) YGNodeRef node;
|
||||
|
||||
@end
|
||||
|
||||
@@ -85,6 +109,7 @@ YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeAll, )
|
||||
|
||||
@synthesize isEnabled=_isEnabled;
|
||||
@synthesize isIncludedInLayout=_isIncludedInLayout;
|
||||
@synthesize node=_node;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
@@ -148,43 +173,44 @@ YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(lowercased_name, capitalized_name, YGEdgeAll, )
|
||||
YGNodeStyleSetPositionType(self.node, position);
|
||||
}
|
||||
|
||||
YG_STYLE_PROPERTY_IMPL(YGDirection, direction, Direction)
|
||||
YG_STYLE_PROPERTY_IMPL(YGFlexDirection, flexDirection, FlexDirection)
|
||||
YG_STYLE_PROPERTY_IMPL(YGJustify, justifyContent, JustifyContent)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignContent, AlignContent)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignItems, AlignItems)
|
||||
YG_STYLE_PROPERTY_IMPL(YGAlign, alignSelf, AlignSelf)
|
||||
YG_STYLE_PROPERTY_IMPL(YGWrap, flexWrap, FlexWrap)
|
||||
YG_STYLE_PROPERTY_IMPL(YGOverflow, overflow, Overflow)
|
||||
YG_PROPERTY(YGDirection, direction, Direction)
|
||||
YG_PROPERTY(YGFlexDirection, flexDirection, FlexDirection)
|
||||
YG_PROPERTY(YGJustify, justifyContent, JustifyContent)
|
||||
YG_PROPERTY(YGAlign, alignContent, AlignContent)
|
||||
YG_PROPERTY(YGAlign, alignItems, AlignItems)
|
||||
YG_PROPERTY(YGAlign, alignSelf, AlignSelf)
|
||||
YG_PROPERTY(YGWrap, flexWrap, FlexWrap)
|
||||
YG_PROPERTY(YGOverflow, overflow, Overflow)
|
||||
YG_PROPERTY(YGDisplay, display, Display)
|
||||
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, flexGrow, FlexGrow)
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, flexShrink, FlexShrink)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(flexBasis, FlexBasis)
|
||||
YG_PROPERTY(CGFloat, flexGrow, FlexGrow)
|
||||
YG_PROPERTY(CGFloat, flexShrink, FlexShrink)
|
||||
YG_VALUE_PROPERTY(flexBasis, FlexBasis)
|
||||
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeLeft, Left)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeTop, Top)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeRight, Right)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeBottom, Bottom)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeStart, Start)
|
||||
YG_STYLE_EDGE_PROPERTY_UNIT_IMPL(position, Position, YGEdgeEnd, End)
|
||||
YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(margin, Margin)
|
||||
YG_STYLE_ALL_EDGE_PROPERTY_UNIT_IMPL(padding, Padding)
|
||||
YG_VALUE_EDGE_PROPERTY(left, Left, Position, YGEdgeLeft)
|
||||
YG_VALUE_EDGE_PROPERTY(top, Top, Position, YGEdgeTop)
|
||||
YG_VALUE_EDGE_PROPERTY(right, Right, Position, YGEdgeRight)
|
||||
YG_VALUE_EDGE_PROPERTY(bottom, Bottom, Position, YGEdgeBottom)
|
||||
YG_VALUE_EDGE_PROPERTY(start, Start, Position, YGEdgeStart)
|
||||
YG_VALUE_EDGE_PROPERTY(end, End, Position, YGEdgeEnd)
|
||||
YG_VALUE_EDGES_PROPERTIES(margin, Margin)
|
||||
YG_VALUE_EDGES_PROPERTIES(padding, Padding)
|
||||
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderLeftWidth, BorderLeftWidth, Border, YGEdgeLeft)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderTopWidth, BorderTopWidth, Border, YGEdgeTop)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderRightWidth, BorderRightWidth, Border, YGEdgeRight)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderBottomWidth, BorderBottomWidth, Border, YGEdgeBottom)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderStartWidth, BorderStartWidth, Border, YGEdgeStart)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderEndWidth, BorderEndWidth, Border, YGEdgeEnd)
|
||||
YG_STYLE_EDGE_PROPERTY_IMPL(borderWidth, BorderWidth, Border, YGEdgeAll)
|
||||
YG_EDGE_PROPERTY(borderLeftWidth, BorderLeftWidth, Border, YGEdgeLeft)
|
||||
YG_EDGE_PROPERTY(borderTopWidth, BorderTopWidth, Border, YGEdgeTop)
|
||||
YG_EDGE_PROPERTY(borderRightWidth, BorderRightWidth, Border, YGEdgeRight)
|
||||
YG_EDGE_PROPERTY(borderBottomWidth, BorderBottomWidth, Border, YGEdgeBottom)
|
||||
YG_EDGE_PROPERTY(borderStartWidth, BorderStartWidth, Border, YGEdgeStart)
|
||||
YG_EDGE_PROPERTY(borderEndWidth, BorderEndWidth, Border, YGEdgeEnd)
|
||||
YG_SHORTHAND_EDGE_PROPERTY(borderWidth, BorderWidth, Border, YGEdgeAll)
|
||||
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(width, Width)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(height, Height)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(minWidth, MinWidth)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(minHeight, MinHeight)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(maxWidth, MaxWidth)
|
||||
YG_STYLE_VALUE_PROPERTY_IMPL(maxHeight, MaxHeight)
|
||||
YG_STYLE_PROPERTY_IMPL(CGFloat, aspectRatio, AspectRatio)
|
||||
YG_VALUE_PROPERTY(width, Width)
|
||||
YG_VALUE_PROPERTY(height, Height)
|
||||
YG_VALUE_PROPERTY(minWidth, MinWidth)
|
||||
YG_VALUE_PROPERTY(minHeight, MinHeight)
|
||||
YG_VALUE_PROPERTY(maxWidth, MaxWidth)
|
||||
YG_VALUE_PROPERTY(maxHeight, MaxHeight)
|
||||
YG_PROPERTY(CGFloat, aspectRatio, AspectRatio)
|
||||
|
||||
#pragma mark - Layout and Sizing
|
||||
|
@@ -10,47 +10,53 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <YogaKit/UIView+Yoga.h>
|
||||
#import <YogaKit/YGLayout+Private.h>
|
||||
#import <yoga/Yoga.h>
|
||||
|
||||
@interface YogaKitTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation YogaKitTests
|
||||
|
||||
#ifndef TRAVIS_CI
|
||||
|
||||
- (void)testNodesAreDeallocedWithSingleView
|
||||
{
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
__weak YGLayout *layoutRef = nil;
|
||||
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
view.yoga.flexBasis = 1;
|
||||
XCTAssertEqual(1, YGNodeGetInstanceCount());
|
||||
view = nil;
|
||||
@autoreleasepool {
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
view.yoga.flexBasis = 1;
|
||||
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
layoutRef = view.yoga;
|
||||
XCTAssertNotNil(layoutRef);
|
||||
|
||||
view = nil;
|
||||
}
|
||||
|
||||
XCTAssertNil(layoutRef);
|
||||
}
|
||||
|
||||
- (void)testNodesAreDeallocedCascade
|
||||
{
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
__weak YGLayout *topLayout = nil;
|
||||
__weak YGLayout *subviewLayout = nil;
|
||||
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
view.yoga.flexBasis = 1;
|
||||
@autoreleasepool {
|
||||
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];
|
||||
subview.yoga.flexBasis = 1;
|
||||
[view addSubview:subview];
|
||||
}
|
||||
XCTAssertEqual(11, YGNodeGetInstanceCount());
|
||||
view = nil;
|
||||
subviewLayout = subview.yoga;
|
||||
subviewLayout.flexBasis = 1;
|
||||
|
||||
XCTAssertEqual(0, YGNodeGetInstanceCount());
|
||||
view = nil;
|
||||
}
|
||||
|
||||
XCTAssertNil(topLayout);
|
||||
XCTAssertNil(subviewLayout);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
- (void)testUsesYoga
|
||||
- (void)testIsEnabled
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
XCTAssertFalse(view.yoga.isEnabled);
|
||||
@@ -87,13 +93,20 @@
|
||||
|
||||
UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
textBadgeView.yoga.isEnabled = YES;
|
||||
textBadgeView.yoga.marginLeft = 3.0;
|
||||
textBadgeView.yoga.margin = 0;
|
||||
textBadgeView.yoga.width = 10;
|
||||
textBadgeView.yoga.height = 10;
|
||||
[container addSubview:textBadgeView];
|
||||
|
||||
const CGSize textBadgeViewSize = textBadgeView.yoga.intrinsicSize;
|
||||
XCTAssertEqual(textBadgeViewSize.height, 10);
|
||||
XCTAssertEqual(textBadgeViewSize.width, 10);
|
||||
|
||||
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
|
||||
@@ -110,13 +123,15 @@
|
||||
[container addSubview:label];
|
||||
|
||||
[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.";
|
||||
XCTAssertTrue(CGSizeEqualToSize(label.frame.size, labelSizeAfterFirstPass));
|
||||
|
||||
[label.yoga markDirty];
|
||||
|
||||
[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
|
||||
@@ -127,18 +142,25 @@
|
||||
container.yoga.isEnabled = YES;
|
||||
container.yoga.flexDirection = YGFlexDirectionRow;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview.yoga.isEnabled = YES;
|
||||
subview.yoga.flexGrow = 1;
|
||||
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview1.yoga.isEnabled = YES;
|
||||
subview1.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];
|
||||
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:1].frame));
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:1].frame, [container.subviews objectAtIndex:2].frame));
|
||||
XCTAssertFalse(CGRectIntersectsRect([container.subviews objectAtIndex:0].frame, [container.subviews objectAtIndex:2].frame));
|
||||
XCTAssertEqualWithAccuracy(subview2.frame.origin.x, CGRectGetMaxX(subview1.frame), FLT_EPSILON);
|
||||
XCTAssertEqualWithAccuracy(subview3.frame.origin.x, CGRectGetMaxX(subview2.frame), FLT_EPSILON);
|
||||
|
||||
CGFloat totalWidth = 0;
|
||||
for (UIView *view in container.subviews) {
|
||||
@@ -174,7 +196,7 @@
|
||||
[container.yoga applyLayout];
|
||||
|
||||
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)));
|
||||
|
||||
[container exchangeSubviewAtIndex:2 withSubviewAtIndex:0];
|
||||
@@ -213,18 +235,18 @@
|
||||
|
||||
[container.yoga applyLayout];
|
||||
|
||||
for (UIView *view in container.subviews) {
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), view.bounds.size), @"Actual size is %@", NSStringFromCGSize(view.bounds.size));
|
||||
for (UIView *subview in container.subviews) {
|
||||
XCTAssertEqual(subview.bounds.size.width, 100);
|
||||
}
|
||||
|
||||
subview3.yoga.isIncludedInLayout = NO;
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
||||
XCTAssertEqual(subview1.bounds.size.width, 150);
|
||||
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.
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(100, 50), subview3.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview3.bounds.size));
|
||||
XCTAssertEqual(subview3.bounds.size.width, 100);
|
||||
}
|
||||
|
||||
- (void)testThatNumberOfChildrenIsCorrectWhenWeIgnoreSubviews
|
||||
@@ -249,11 +271,11 @@
|
||||
[container addSubview:subview3];
|
||||
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertEqual(1, container.yoga.numberOfChildren);
|
||||
XCTAssertEqual(container.yoga.numberOfChildren, 1);
|
||||
|
||||
subview2.yoga.isIncludedInLayout = YES;
|
||||
[container.yoga applyLayout];
|
||||
XCTAssertEqual(2, container.yoga.numberOfChildren);
|
||||
XCTAssertEqual(container.yoga.numberOfChildren, 2);
|
||||
}
|
||||
|
||||
- (void)testThatViewNotIncludedInFirstLayoutPassAreIncludedInSecond
|
||||
@@ -280,18 +302,19 @@
|
||||
|
||||
[container.yoga applyLayout];
|
||||
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview1.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview1.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeMake(150, 50), subview2.bounds.size), @"Actual size is %@", NSStringFromCGSize(subview2.bounds.size));
|
||||
XCTAssertTrue(CGSizeEqualToSize(CGSizeZero, subview3.bounds.size), @"Actual size %@", NSStringFromCGSize(subview3.bounds.size));
|
||||
XCTAssertEqual(subview1.bounds.size.width, 150);
|
||||
XCTAssertEqual(subview2.bounds.size.width, 150);
|
||||
XCTAssertEqual(subview3.bounds.size.width, 0);
|
||||
|
||||
subview3.yoga.isIncludedInLayout = YES;
|
||||
[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];
|
||||
XCTAssertTrue(view.yoga.isLeaf);
|
||||
@@ -349,18 +372,22 @@
|
||||
}
|
||||
[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) {
|
||||
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.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) {
|
||||
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.width));
|
||||
}
|
||||
@@ -384,4 +411,211 @@
|
||||
[container.yoga applyLayout];
|
||||
}
|
||||
|
||||
- (void)testPositionalPropertiesWork
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
view.yoga.left = 1;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeLeft).value, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.left, 1);
|
||||
|
||||
view.yoga.right = 2;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeRight).value, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.right, 2);
|
||||
|
||||
view.yoga.top = 3;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeTop).value, 3);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.top, 3);
|
||||
|
||||
view.yoga.bottom = 4;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeBottom).value, 4);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.bottom, 4);
|
||||
|
||||
view.yoga.start = 5;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeStart).value, 5);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.start, 5);
|
||||
|
||||
view.yoga.end = 6;
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeEnd).value, 6);
|
||||
XCTAssertEqual(YGNodeStyleGetPosition(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.end, 6);
|
||||
}
|
||||
|
||||
- (void)testMarginPropertiesWork
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
view.yoga.margin = 1;
|
||||
XCTAssertEqual(view.yoga.marginLeft, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginRight, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginStart, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginEnd, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginTop, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginBottom, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.marginHorizontal));
|
||||
XCTAssertTrue(isnan(view.yoga.marginVertical));
|
||||
XCTAssertTrue(isnan(view.yoga.margin));
|
||||
|
||||
view.yoga.marginHorizontal = 2;
|
||||
XCTAssertEqual(view.yoga.marginLeft, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginRight, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginStart, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginEnd, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.marginHorizontal));
|
||||
|
||||
view.yoga.marginVertical = 3;
|
||||
XCTAssertEqual(view.yoga.marginTop, 3);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginBottom, 3);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.marginVertical));
|
||||
|
||||
view.yoga.marginLeft = 4;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeLeft).value, 4);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginLeft, 4);
|
||||
|
||||
view.yoga.marginRight = 5;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeRight).value, 5);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginRight, 5);
|
||||
|
||||
view.yoga.marginTop = 6;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeTop).value, 6);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginTop, 6);
|
||||
|
||||
view.yoga.marginBottom = 7;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeBottom).value, 7);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginBottom, 7);
|
||||
|
||||
view.yoga.marginStart = 8;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeStart).value, 8);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginStart, 8);
|
||||
|
||||
view.yoga.marginEnd = 9;
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeEnd).value, 9);
|
||||
XCTAssertEqual(YGNodeStyleGetMargin(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.marginEnd, 9);
|
||||
}
|
||||
|
||||
- (void)testPaddingPropertiesWork
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
view.yoga.padding = 1;
|
||||
XCTAssertEqual(view.yoga.paddingLeft, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingRight, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingStart, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingEnd, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingTop, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingBottom, 1);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.paddingHorizontal));
|
||||
XCTAssertTrue(isnan(view.yoga.paddingVertical));
|
||||
XCTAssertTrue(isnan(view.yoga.padding));
|
||||
|
||||
view.yoga.paddingHorizontal = 2;
|
||||
XCTAssertEqual(view.yoga.paddingLeft, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingRight, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingStart, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingEnd, 2);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.paddingHorizontal));
|
||||
|
||||
view.yoga.paddingVertical = 3;
|
||||
XCTAssertEqual(view.yoga.paddingTop, 3);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingBottom, 3);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertTrue(isnan(view.yoga.paddingVertical));
|
||||
|
||||
view.yoga.paddingLeft = 4;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeLeft).value, 4);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeLeft).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingLeft, 4);
|
||||
|
||||
view.yoga.paddingRight = 5;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeRight).value, 5);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeRight).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingRight, 5);
|
||||
|
||||
view.yoga.paddingTop = 6;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeTop).value, 6);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeTop).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingTop, 6);
|
||||
|
||||
view.yoga.paddingBottom = 7;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeBottom).value, 7);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeBottom).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingBottom, 7);
|
||||
|
||||
view.yoga.paddingStart = 8;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeStart).value, 8);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeStart).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingStart, 8);
|
||||
|
||||
view.yoga.paddingEnd = 9;
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeEnd).value, 9);
|
||||
XCTAssertEqual(YGNodeStyleGetPadding(view.yoga.node, YGEdgeEnd).unit, YGUnitPixel);
|
||||
XCTAssertEqual(view.yoga.paddingEnd, 9);
|
||||
}
|
||||
|
||||
- (void)testBorderWidthPropertiesWork
|
||||
{
|
||||
UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
|
||||
view.yoga.borderWidth = 1;
|
||||
XCTAssertEqual(view.yoga.borderLeftWidth, 1);
|
||||
XCTAssertEqual(view.yoga.borderRightWidth, 1);
|
||||
XCTAssertEqual(view.yoga.borderStartWidth, 1);
|
||||
XCTAssertEqual(view.yoga.borderEndWidth, 1);
|
||||
XCTAssertEqual(view.yoga.borderTopWidth, 1);
|
||||
XCTAssertEqual(view.yoga.borderBottomWidth, 1);
|
||||
XCTAssertTrue(isnan(view.yoga.borderWidth));
|
||||
|
||||
view.yoga.borderLeftWidth = 2;
|
||||
XCTAssertEqual(view.yoga.borderLeftWidth, 2);
|
||||
|
||||
view.yoga.borderRightWidth = 3;
|
||||
XCTAssertEqual(view.yoga.borderRightWidth, 3);
|
||||
|
||||
view.yoga.borderTopWidth = 4;
|
||||
XCTAssertEqual(view.yoga.borderTopWidth, 4);
|
||||
|
||||
view.yoga.borderBottomWidth = 5;
|
||||
XCTAssertEqual(view.yoga.borderBottomWidth, 5);
|
||||
|
||||
view.yoga.borderStartWidth = 6;
|
||||
XCTAssertEqual(view.yoga.borderStartWidth, 6);
|
||||
|
||||
view.yoga.borderEndWidth = 7;
|
||||
XCTAssertEqual(view.yoga.borderEndWidth, 7);
|
||||
}
|
||||
|
||||
@end
|
||||
|
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,20 +11,22 @@
|
||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4A1DF8748400E7C260 /* AppDelegate.m */; };
|
||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13687D4D1DF8748400E7C260 /* ViewController.m */; };
|
||||
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 */; };
|
||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13687D861DF87D2400E7C260 /* Foundation.framework */; };
|
||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 638A94411E1EF5D000A726AD /* YGLayout.m */; };
|
||||
638A94451E1EF8A900A726AD /* YGValue.h in yoga */ = {isa = PBXBuildFile; fileRef = 638A94441E1EF89C00A726AD /* YGValue.h */; };
|
||||
15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */; };
|
||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638A94471E1F06D100A726AD /* SwiftViewController.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
638A94541E215CC800A726AD /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 13687D3B1DF8748300E7C260 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 13687D421DF8748300E7C260;
|
||||
remoteInfo = YogaKitSample;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
13687D771DF878A000E7C260 /* yoga */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
@@ -32,10 +34,6 @@
|
||||
dstPath = include/yoga;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
638A94451E1EF8A900A726AD /* YGValue.h in yoga */,
|
||||
13687D781DF878C600E7C260 /* YGEnums.h in yoga */,
|
||||
13687D791DF878C600E7C260 /* YGMacros.h in yoga */,
|
||||
13687D7A1DF878C600E7C260 /* Yoga.h in yoga */,
|
||||
);
|
||||
name = yoga;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -46,7 +44,6 @@
|
||||
dstPath = include/YogaKit;
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
13687D7C1DF878DD00E7C260 /* UIView+Yoga.h in YogaKit */,
|
||||
);
|
||||
name = YogaKit;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -62,22 +59,13 @@
|
||||
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>"; };
|
||||
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; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
638A94441E1EF89C00A726AD /* YGValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGValue.h; sourceTree = "<group>"; };
|
||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YogaKitSample-Bridging-Header.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>"; };
|
||||
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; };
|
||||
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>"; };
|
||||
C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YogaKitSample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -87,6 +75,14 @@
|
||||
files = (
|
||||
13687D871DF87D2400E7C260 /* Foundation.framework in Frameworks */,
|
||||
13687D851DF87D1E00E7C260 /* UIKit.framework in Frameworks */,
|
||||
15A7CB5995C9DAB1C8803834 /* Pods_YogaKitSample.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
638A944C1E215CC800A726AD /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -96,11 +92,10 @@
|
||||
13687D3A1DF8748300E7C260 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D5D1DF8778F00E7C260 /* yoga */,
|
||||
13687D641DF8778F00E7C260 /* YogaKit */,
|
||||
13687D451DF8748400E7C260 /* YogaKitSample */,
|
||||
13687D441DF8748400E7C260 /* Products */,
|
||||
13687D831DF87D1E00E7C260 /* Frameworks */,
|
||||
E1C759E3C8E84821213ECE8D /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -108,6 +103,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D431DF8748400E7C260 /* YogaKitSample.app */,
|
||||
638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -120,7 +116,6 @@
|
||||
13687D4C1DF8748400E7C260 /* ViewController.h */,
|
||||
13687D4D1DF8748400E7C260 /* ViewController.m */,
|
||||
638A94471E1F06D100A726AD /* SwiftViewController.swift */,
|
||||
638A94461E1F06D100A726AD /* YogaKitSample-Bridging-Header.h */,
|
||||
13687D521DF8748400E7C260 /* Assets.xcassets */,
|
||||
13687D571DF8748400E7C260 /* Info.plist */,
|
||||
13687D461DF8748400E7C260 /* Supporting Files */,
|
||||
@@ -136,43 +131,25 @@
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
13687D5D1DF8778F00E7C260 /* yoga */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
638A94441E1EF89C00A726AD /* YGValue.h */,
|
||||
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 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
13687D861DF87D2400E7C260 /* Foundation.framework */,
|
||||
13687D841DF87D1E00E7C260 /* UIKit.framework */,
|
||||
C80A931E90C7F3088CB86822 /* Pods_YogaKitSample.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E1C759E3C8E84821213ECE8D /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */,
|
||||
82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -180,11 +157,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 13687D5A1DF8748400E7C260 /* Build configuration list for PBXNativeTarget "YogaKitSample" */;
|
||||
buildPhases = (
|
||||
513B543F92B2E4F4D1EE1CE7 /* [CP] Check Pods Manifest.lock */,
|
||||
13687D771DF878A000E7C260 /* yoga */,
|
||||
13687D7B1DF878CE00E7C260 /* YogaKit */,
|
||||
13687D3F1DF8748300E7C260 /* Sources */,
|
||||
13687D401DF8748300E7C260 /* Frameworks */,
|
||||
13687D411DF8748300E7C260 /* Resources */,
|
||||
FA2FB9DD6471BDD3FBCE503B /* [CP] Embed Pods Frameworks */,
|
||||
6E01EB987F1564F3D71EBE5A /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -195,6 +175,24 @@
|
||||
productReference = 13687D431DF8748400E7C260 /* YogaKitSample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
638A944E1E215CC800A726AD /* YogaKitSampleTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 638A94561E215CC800A726AD /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */;
|
||||
buildPhases = (
|
||||
638A944B1E215CC800A726AD /* Sources */,
|
||||
638A944C1E215CC800A726AD /* Frameworks */,
|
||||
638A944D1E215CC800A726AD /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
638A94551E215CC800A726AD /* PBXTargetDependency */,
|
||||
);
|
||||
name = YogaKitSampleTests;
|
||||
productName = YogaKitSampleTests;
|
||||
productReference = 638A944F1E215CC800A726AD /* YogaKitSampleTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -209,6 +207,11 @@
|
||||
LastSwiftMigration = 0820;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
638A944E1E215CC800A726AD = {
|
||||
CreatedOnToolsVersion = 8.2.1;
|
||||
ProvisioningStyle = Automatic;
|
||||
TestTargetID = 13687D421DF8748300E7C260;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 13687D3E1DF8748300E7C260 /* Build configuration list for PBXProject "YogaKitSample" */;
|
||||
@@ -225,6 +228,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
13687D421DF8748300E7C260 /* YogaKitSample */,
|
||||
638A944E1E215CC800A726AD /* YogaKitSampleTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -238,26 +242,92 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
638A944D1E215CC800A726AD /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* 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 */
|
||||
13687D3F1DF8748300E7C260 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
638A94481E1F06D100A726AD /* SwiftViewController.swift in Sources */,
|
||||
13687D801DF87CEC00E7C260 /* UIView+Yoga.m in Sources */,
|
||||
13687D4E1DF8748400E7C260 /* ViewController.m in Sources */,
|
||||
13687D4B1DF8748400E7C260 /* AppDelegate.m in Sources */,
|
||||
13687D821DF87CF200E7C260 /* Yoga.c in Sources */,
|
||||
13687D811DF87CF200E7C260 /* YGNodeList.c in Sources */,
|
||||
13687D481DF8748400E7C260 /* main.m in Sources */,
|
||||
638A94431E1EF5D000A726AD /* YGLayout.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
638A944B1E215CC800A726AD /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
638A94551E215CC800A726AD /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 13687D421DF8748300E7C260 /* YogaKitSample */;
|
||||
targetProxy = 638A94541E215CC800A726AD /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
13687D581DF8748400E7C260 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
@@ -351,6 +421,7 @@
|
||||
};
|
||||
13687D5B1DF8748400E7C260 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 1D2FF4D5FCA6A8C54A4074A3 /* Pods-YogaKitSample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -358,7 +429,7 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
||||
SWIFT_INSTALL_OBJC_HEADER = NO;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
@@ -366,6 +437,7 @@
|
||||
};
|
||||
13687D5C1DF8748400E7C260 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 82F0896A88112E957EF37C7F /* Pods-YogaKitSample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
@@ -373,11 +445,39 @@
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "YogaKitSample/YogaKitSample-Bridging-Header.h";
|
||||
SWIFT_INSTALL_OBJC_HEADER = NO;
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
638A94571E215CC800A726AD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = YogaKitSampleTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
638A94581E215CC800A726AD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = YogaKitSampleTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.YogaKitSampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YogaKitSample.app/YogaKitSample";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -399,6 +499,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
638A94561E215CC800A726AD /* Build configuration list for PBXNativeTarget "YogaKitSampleTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
638A94571E215CC800A726AD /* Debug */,
|
||||
638A94581E215CC800A726AD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 13687D3B1DF8748300E7C260 /* Project object */;
|
||||
|
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;
|
||||
|
||||
@end
|
||||
|
||||
|
@@ -1,43 +1,69 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Yoga-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Yoga-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Yoga-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"filename" : "Yoga-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"filename" : "Yoga-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"filename" : "Yoga-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"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",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Yoga-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Yoga-60x60@3x.png",
|
||||
"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 YogaKit
|
||||
|
||||
class SwiftViewController: UIViewController {
|
||||
override func viewDidLoad() {
|
||||
|
@@ -10,6 +10,4 @@
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
|
||||
@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>
|
||||
|
||||
static YGSize _measure(YGNodeRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode) {
|
||||
return (YGSize){
|
||||
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
|
||||
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
#define NUM_REPETITIONS 1000
|
||||
|
||||
#define YGBENCHMARKS(BLOCK) \
|
||||
#define YGBENCHMARKS(BLOCK) \
|
||||
int main(int argc, char const *argv[]) { \
|
||||
clock_t __start; \
|
||||
clock_t __endTimes[NUM_REPETITIONS]; \
|
||||
@@ -25,7 +25,7 @@
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#define YGBENCHMARK(NAME, BLOCK) \
|
||||
#define YGBENCHMARK(NAME, BLOCK) \
|
||||
__start = clock(); \
|
||||
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
|
||||
{ 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>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)BaselineFunction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Border.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureFunction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)MeasureOutput.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Native.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Spacing.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaAlign.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaBaselineFunc.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaConstants.cs" />
|
||||
@@ -28,7 +26,6 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaLogLevel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureFunc.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaMeasureMode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Create.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.Spacing.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaNode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaOverflow.cs" />
|
||||
@@ -40,4 +37,4 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaValueExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)YogaWrap.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@@ -169,6 +169,12 @@ namespace Facebook.Yoga
|
||||
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
|
||||
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)]
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
get
|
||||
|
@@ -10,18 +10,13 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include "stdafx.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -6,9 +6,9 @@
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -16,10 +16,8 @@
|
||||
|
||||
#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:
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// 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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
@@ -310,5 +310,384 @@ namespace Facebook.Yoga
|
||||
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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
@@ -354,5 +354,61 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(30f, root_child3.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_flex_wrap_children_with_min_main_overriding_flex_basis()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.FlexDirection = YogaFlexDirection.Row;
|
||||
root.Wrap = YogaWrap.Wrap;
|
||||
root.Width = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexBasis = 50;
|
||||
root_child0.MinWidth = 55;
|
||||
root_child0.Height = 50;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
root_child1.FlexBasis = 50;
|
||||
root_child1.MinWidth = 55;
|
||||
root_child1.Height = 50;
|
||||
root.Insert(1, root_child1);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(55f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(55f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
|
||||
Assert.AreEqual(0f, root.LayoutX);
|
||||
Assert.AreEqual(0f, root.LayoutY);
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
Assert.AreEqual(100f, root.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(45f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(55f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(45f, root_child1.LayoutX);
|
||||
Assert.AreEqual(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(55f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
@@ -184,6 +184,7 @@ namespace Facebook.Yoga
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginStart = 10;
|
||||
root_child0.MarginEnd = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -195,7 +196,7 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
@@ -206,9 +207,9 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
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(90f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
@@ -222,6 +223,7 @@ namespace Facebook.Yoga
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginTop = 10;
|
||||
root_child0.MarginBottom = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -234,7 +236,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
@@ -247,7 +249,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -261,6 +263,7 @@ namespace Facebook.Yoga
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginTop = 10;
|
||||
root_child0.MarginBottom = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -273,7 +276,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
@@ -286,7 +289,7 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(10f, root_child0.LayoutY);
|
||||
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(90f, root_child0.LayoutHeight);
|
||||
Assert.AreEqual(80f, root_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -299,6 +302,7 @@ namespace Facebook.Yoga
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginStart = 10;
|
||||
root_child0.MarginEnd = 10;
|
||||
root.Insert(0, root_child0);
|
||||
root.StyleDirection = YogaDirection.LTR;
|
||||
root.CalculateLayout();
|
||||
@@ -310,7 +314,7 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(10f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
Assert.AreEqual(90f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
@@ -321,9 +325,9 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
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(90f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(80f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
@@ -337,6 +341,7 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginEnd = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
@@ -352,12 +357,12 @@ namespace Facebook.Yoga
|
||||
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
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(50f, root_child1.LayoutX);
|
||||
Assert.AreEqual(55f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(45f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
@@ -368,14 +373,14 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(100f, root.LayoutWidth);
|
||||
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(50f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(45f, root_child0.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child1.LayoutX);
|
||||
Assert.AreEqual(0f, root_child1.LayoutY);
|
||||
Assert.AreEqual(50f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(45f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(100f, root_child1.LayoutHeight);
|
||||
}
|
||||
|
||||
@@ -388,6 +393,7 @@ namespace Facebook.Yoga
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.FlexGrow = 1;
|
||||
root_child0.MarginBottom = 10;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child1 = new YogaNode();
|
||||
@@ -404,12 +410,12 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
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(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(55f, root_child1.LayoutY);
|
||||
Assert.AreEqual(100f, root_child1.LayoutWidth);
|
||||
Assert.AreEqual(50f, root_child1.LayoutHeight);
|
||||
Assert.AreEqual(45f, root_child1.LayoutHeight);
|
||||
|
||||
root.StyleDirection = YogaDirection.RTL;
|
||||
root.CalculateLayout();
|
||||
@@ -422,12 +428,12 @@ namespace Facebook.Yoga
|
||||
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||
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(50f, root_child1.LayoutY);
|
||||
Assert.AreEqual(55f, root_child1.LayoutY);
|
||||
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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* 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 NUnit.Framework;
|
||||
@@ -955,5 +955,41 @@ namespace Facebook.Yoga
|
||||
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.
|
||||
*/
|
||||
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
177
csharp/tests/Facebook.Yoga/YGSizeOverflowTest.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
/**
|
||||
* 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/YGSizeOverflowTest.html
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Facebook.Yoga
|
||||
{
|
||||
[TestFixture]
|
||||
public class YGSizeOverflowTest
|
||||
{
|
||||
[Test]
|
||||
public void Test_nested_overflowing_child()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 200;
|
||||
root_child0_child0.Height = 200;
|
||||
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(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, 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(200f, root_child0.LayoutHeight);
|
||||
|
||||
Assert.AreEqual(-100f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_nested_overflowing_child_in_constraint_parent()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 100;
|
||||
root_child0.Height = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 200;
|
||||
root_child0_child0.Height = 200;
|
||||
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(200f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, 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(-100f, root_child0_child0.LayoutX);
|
||||
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||
Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
|
||||
Assert.AreEqual(200f, root_child0_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_parent_wrap_child_size_overflowing_parent()
|
||||
{
|
||||
YogaNode root = new YogaNode();
|
||||
root.Width = 100;
|
||||
root.Height = 100;
|
||||
|
||||
YogaNode root_child0 = new YogaNode();
|
||||
root_child0.Width = 100;
|
||||
root.Insert(0, root_child0);
|
||||
|
||||
YogaNode root_child0_child0 = new YogaNode();
|
||||
root_child0_child0.Width = 100;
|
||||
root_child0_child0.Height = 200;
|
||||
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(200f, 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(200f, 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(200f, 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(200f, root_child0_child0.LayoutHeight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -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`
|
16
enums.py
@@ -52,6 +52,10 @@ ENUMS = {
|
||||
'Relative',
|
||||
'Absolute',
|
||||
],
|
||||
'Display': [
|
||||
'Flex',
|
||||
'None',
|
||||
],
|
||||
'Wrap': [
|
||||
'NoWrap',
|
||||
'Wrap',
|
||||
@@ -125,7 +129,7 @@ with open(root + '/yoga/YGEnums.h', 'w') as f:
|
||||
f.write('#pragma once\n\n')
|
||||
f.write('#include "YGMacros.h"\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('typedef YG_ENUM_BEGIN(YG%s) {\n' % name)
|
||||
for value in values:
|
||||
@@ -138,7 +142,7 @@ with open(root + '/yoga/YGEnums.h', 'w') as f:
|
||||
f.write('YG_EXTERN_C_END\n')
|
||||
|
||||
# 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:
|
||||
f.write(LICENSE)
|
||||
f.write('package com.facebook.yoga;\n\n')
|
||||
@@ -175,13 +179,13 @@ for name, values in ENUMS.items():
|
||||
f.write(' case %d: return %s;\n' % (value[1], to_java_upper(value[0])))
|
||||
else:
|
||||
f.write(' case %d: return %s;\n' % (values.index(value), to_java_upper(value)))
|
||||
f.write(' default: throw new IllegalArgumentException("Unkown enum value: " + value);\n')
|
||||
f.write(' default: throw new IllegalArgumentException("Unknown enum value: " + value);\n')
|
||||
f.write(' }\n')
|
||||
f.write(' }\n')
|
||||
f.write('}\n')
|
||||
|
||||
# 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:
|
||||
f.write(LICENSE)
|
||||
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:
|
||||
f.write(LICENSE)
|
||||
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)))
|
||||
base = 0
|
||||
for value in values:
|
||||
@@ -208,5 +212,5 @@ with open(root + '/javascript/sources/YGEnums.js', 'w') as f:
|
||||
else:
|
||||
f.write(' %s_%s: %d,\n' % (to_java_upper(name), to_java_upper(value), base))
|
||||
base += 1
|
||||
f.write('\n');
|
||||
f.write('\n')
|
||||
f.write('};\n')
|
||||
|
68
format.sh
@@ -1,34 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
clang-format \
|
||||
-style="{ \
|
||||
AlignAfterOpenBracket: Align, \
|
||||
AlignEscapedNewlinesLeft: true, \
|
||||
AlignOperands: true, \
|
||||
AllowAllParametersOfDeclarationOnNextLine: false, \
|
||||
AllowShortBlocksOnASingleLine: false, \
|
||||
AllowShortCaseLabelsOnASingleLine: false, \
|
||||
AllowShortFunctionsOnASingleLine: false, \
|
||||
AllowShortIfStatementsOnASingleLine: false, \
|
||||
AllowShortLoopsOnASingleLine: false, \
|
||||
BinPackArguments: false, \
|
||||
BinPackParameters: false, \
|
||||
BreakBeforeBraces: Attach, \
|
||||
ColumnLimit: 100, \
|
||||
ContinuationIndentWidth: 4, \
|
||||
IndentCaseLabels: true, \
|
||||
IndentWidth: 2, \
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false, \
|
||||
Language: Cpp, \
|
||||
PenaltyBreakBeforeFirstCallParameter: 100, \
|
||||
PenaltyBreakString: 1000, \
|
||||
PenaltyExcessCharacter: 100, \
|
||||
PenaltyReturnTypeOnItsOwnLine: 100, \
|
||||
PointerAlignment: Right, \
|
||||
SortIncludes: true, \
|
||||
SpaceAfterCStyleCast: true, \
|
||||
UseTab: Never, \
|
||||
}" "$@" \
|
||||
-i $(dirname $0)/yoga/*.{h,c,cpp} \
|
||||
$(dirname $0)/benchmarks/*.{h,c,cpp} \
|
||||
$(dirname $0)/java/jni/*.{h,c,cpp}
|
||||
BASEDIR="$(dirname "$0")"
|
||||
FILES=$(find "$BASEDIR" \( -path "$BASEDIR/buck-out" -o -path "$BASEDIR/lib" \) -prune -o \
|
||||
\( -name \*.h -o -name \*.c -o -name \*.cpp \) -print)
|
||||
|
||||
for f in $FILES "$@"; do
|
||||
clang-format \
|
||||
-style="{ \
|
||||
AlignAfterOpenBracket: Align, \
|
||||
AlignEscapedNewlinesLeft: true, \
|
||||
AlignOperands: true, \
|
||||
AllowAllParametersOfDeclarationOnNextLine: false, \
|
||||
AllowShortBlocksOnASingleLine: false, \
|
||||
AllowShortCaseLabelsOnASingleLine: false, \
|
||||
AllowShortFunctionsOnASingleLine: false, \
|
||||
AllowShortIfStatementsOnASingleLine: false, \
|
||||
AllowShortLoopsOnASingleLine: false, \
|
||||
BinPackArguments: false, \
|
||||
BinPackParameters: false, \
|
||||
BreakBeforeBraces: Attach, \
|
||||
ColumnLimit: 100, \
|
||||
ContinuationIndentWidth: 4, \
|
||||
IndentCaseLabels: true, \
|
||||
IndentWidth: 2, \
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false, \
|
||||
Language: Cpp, \
|
||||
PenaltyBreakBeforeFirstCallParameter: 100, \
|
||||
PenaltyBreakString: 1000, \
|
||||
PenaltyExcessCharacter: 100, \
|
||||
PenaltyReturnTypeOnItsOwnLine: 100, \
|
||||
PointerAlignment: Right, \
|
||||
SortIncludes: true, \
|
||||
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; right: 0px; bottom: 0px;"></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>
|
@@ -25,3 +25,8 @@
|
||||
<div style="height: 30px; width: 30px;"></div>
|
||||
<div style="height: 30px; width: 30px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="flex_wrap_children_with_min_main_overriding_flex_basis" style="width: 100px; flex-wrap: wrap; flex-direction: row;">
|
||||
<div style="flex-basis: 50px; height: 50px; min-width: 55px;"></div>
|
||||
<div style="flex-basis: 50px; height: 50px; min-width: 55px;"></div>
|
||||
</div>
|
||||
|
@@ -15,27 +15,27 @@
|
||||
</div>
|
||||
|
||||
<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 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 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 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 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>
|
||||
|
||||
<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>
|
||||
|
@@ -45,7 +45,6 @@
|
||||
<div style="flex-grow: 4; flex-basis: 15%; max-width: 20%;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="percentage_flex_basis_main_min_width" experiments="Rounding" style="width: 200px; height: 200px; flex-direction: row;">
|
||||
<div style="flex-grow: 1; flex-basis: 15%; min-width: 60%;"></div>
|
||||
<div style="flex-grow: 4; flex-basis: 10%; min-width: 20%;"></div>
|
||||
@@ -79,4 +78,8 @@
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div id="percentage_width_height_undefined_parent_size">
|
||||
<div style="width: 50%; height: 50%;"></div>
|
||||
</div>
|
||||
|
17
gentest/fixtures/YGSizeOverflowTest.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<div id="nested_overflowing_child" style="height: 100px; width: 100px;">
|
||||
<div>
|
||||
<div style="height: 200px; width: 200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nested_overflowing_child_in_constraint_parent" style="height: 100px; width: 100px;">
|
||||
<div style="height: 100px; width: 100px;">
|
||||
<div style="height: 200px; width: 200px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="parent_wrap_child_size_overflowing_parent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 100px;">
|
||||
<div style="width: 100px; height: 200px;"></div>
|
||||
</div>
|
||||
</div>
|
@@ -28,8 +28,8 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue:{value:function() {
|
||||
this.push([
|
||||
'#include <yoga/Yoga.h>',
|
||||
'#include <gtest/gtest.h>',
|
||||
'#include <yoga/Yoga.h>',
|
||||
'',
|
||||
]);
|
||||
}},
|
||||
@@ -118,6 +118,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YGUndefined'},
|
||||
|
||||
YGDisplayFlex:{value:'YGDisplayFlex'},
|
||||
YGDisplayNone:{value:'YGDisplayNone'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||
this.push('YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');');
|
||||
}},
|
||||
@@ -162,6 +165,10 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push('YGNodeStyleSetDisplay(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push('YGNodeStyleSetFlexBasis' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');');
|
||||
}},
|
||||
|
@@ -128,6 +128,9 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YogaConstants.Undefined'},
|
||||
|
||||
YGDisplayFlex:{value:'YogaDisplay.Flex'},
|
||||
YGDisplayNone:{value:'YogaDisplay.None'},
|
||||
|
||||
YGWrapNoWrap:{value:'YogaWrap.NoWrap'},
|
||||
YGWrapWrap:{value:'YogaWrap.Wrap'},
|
||||
|
||||
@@ -176,6 +179,10 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(nodeName + '.StyleDirection = ' + toValueCs(value) + ';');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.Display = ' + toValueCs(value) + ';');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.FlexBasis = ' + toCsUnitValue(value) + ';');
|
||||
}},
|
||||
|
@@ -132,12 +132,15 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'YogaConstants.UNDEFINED'},
|
||||
|
||||
YGDisplayFlex:{value:'YogaDisplay.FLEX'},
|
||||
YGDisplayNone:{value:'YogaDisplay.NONE'},
|
||||
|
||||
YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'},
|
||||
YGWrapWrap:{value:'YogaWrap.WRAP'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, dir) {
|
||||
this.push(node + '.setDirection(' + dir + ');');
|
||||
this.push(node + '.calculateLayout();');
|
||||
this.push(node + '.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);');
|
||||
}},
|
||||
|
||||
YGNodeInsertChild:{value:function(parentName, nodeName, index) {
|
||||
@@ -180,6 +183,10 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push(nodeName + '.setDirection(' + toValueJava(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setFlexBasis' + toMethodName(value) + '(' + toValueJava(value) + 'f);');
|
||||
}},
|
||||
|
@@ -125,6 +125,9 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGUndefined:{value:'Yoga.UNDEFINED'},
|
||||
|
||||
YGDisplayFlex:{value:'Yoga.DISPLAY_FLEX'},
|
||||
YGDisplayNone:{value:'Yoga.DISPLAY_NONE'},
|
||||
|
||||
YGNodeCalculateLayout:{value:function(node, 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) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetDisplay:{value:function(nodeName, value) {
|
||||
this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');');
|
||||
}},
|
||||
|
||||
YGNodeStyleSetFlexBasis:{value:function(nodeName, 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.',
|
||||
' */',
|
||||
'',
|
||||
' // @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
|
||||
'// @Generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html',
|
||||
'',
|
||||
]);
|
||||
e.emitPrologue();
|
||||
@@ -140,6 +140,7 @@ function checkDefaultValues() {
|
||||
{style:'top', value:'undefined'},
|
||||
{style:'right', value:'undefined'},
|
||||
{style:'bottom', value:'undefined'},
|
||||
{style:'display', value:'flex'},
|
||||
].forEach(function(item) {
|
||||
assert(item.value === getDefaultStyleValue(item.style),
|
||||
item.style + ' should be ' + item.value);
|
||||
@@ -300,6 +301,9 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
|
||||
case 'max-height':
|
||||
e.YGNodeStyleSetMaxHeight(nodeName, pixelValue(e, node.style[style]));
|
||||
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) {
|
||||
if (style == 'position') {
|
||||
return 'relative';
|
||||
@@ -466,6 +477,7 @@ function getYogaStyle(node) {
|
||||
'height',
|
||||
'min-height',
|
||||
'max-height',
|
||||
'display',
|
||||
].reduce(function(map, key) {
|
||||
map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||
return map;
|
||||
|
@@ -38,7 +38,7 @@ public enum YogaAlign {
|
||||
case 3: return FLEX_END;
|
||||
case 4: return STRETCH;
|
||||
case 5: return BASELINE;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public enum YogaDimension {
|
||||
switch (value) {
|
||||
case 0: return WIDTH;
|
||||
case 1: return HEIGHT;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public enum YogaDirection {
|
||||
case 0: return INHERIT;
|
||||
case 1: return LTR;
|
||||
case 2: return RTL;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
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);
|
||||
}
|
||||
}
|
||||
}
|
@@ -44,7 +44,7 @@ public enum YogaEdge {
|
||||
case 6: return HORIZONTAL;
|
||||
case 7: return VERTICAL;
|
||||
case 8: return ALL;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ public enum YogaExperimentalFeature {
|
||||
switch (value) {
|
||||
case 0: return ROUNDING;
|
||||
case 1: return WEB_FLEX_BASIS;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ public enum YogaFlexDirection {
|
||||
case 1: return COLUMN_REVERSE;
|
||||
case 2: return ROW;
|
||||
case 3: return ROW_REVERSE;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public enum YogaJustify {
|
||||
case 2: return FLEX_END;
|
||||
case 3: return SPACE_BETWEEN;
|
||||
case 4: return SPACE_AROUND;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public enum YogaLogLevel {
|
||||
case 2: return INFO;
|
||||
case 3: return DEBUG;
|
||||
case 4: return VERBOSE;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public enum YogaMeasureMode {
|
||||
case 0: return UNDEFINED;
|
||||
case 1: return EXACTLY;
|
||||
case 2: return AT_MOST;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
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);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeCalculateLayout(long nativePointer);
|
||||
private native void jni_YGNodeCalculateLayout(long nativePointer, float width, float height);
|
||||
@Override
|
||||
public void calculateLayout() {
|
||||
jni_YGNodeCalculateLayout(mNativePointer);
|
||||
public void calculateLayout(float width, float height) {
|
||||
jni_YGNodeCalculateLayout(mNativePointer, width, height);
|
||||
}
|
||||
|
||||
private native boolean jni_YGNodeHasNewLayout(long nativePointer);
|
||||
@@ -211,7 +211,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
private native int jni_YGNodeStyleGetDirection(long nativePointer);
|
||||
@Override
|
||||
public YogaDirection getStyleDirection() {
|
||||
return YogaDirection.values()[jni_YGNodeStyleGetDirection(mNativePointer)];
|
||||
return YogaDirection.fromInt(jni_YGNodeStyleGetDirection(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaFlexDirection getFlexDirection() {
|
||||
return YogaFlexDirection.values()[jni_YGNodeStyleGetFlexDirection(mNativePointer)];
|
||||
return YogaFlexDirection.fromInt(jni_YGNodeStyleGetFlexDirection(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaJustify getJustifyContent() {
|
||||
return YogaJustify.values()[jni_YGNodeStyleGetJustifyContent(mNativePointer)];
|
||||
return YogaJustify.fromInt(jni_YGNodeStyleGetJustifyContent(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaAlign getAlignItems() {
|
||||
return YogaAlign.values()[jni_YGNodeStyleGetAlignItems(mNativePointer)];
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignItems(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaAlign getAlignSelf() {
|
||||
return YogaAlign.values()[jni_YGNodeStyleGetAlignSelf(mNativePointer)];
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignSelf(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaAlign getAlignContent() {
|
||||
return YogaAlign.values()[jni_YGNodeStyleGetAlignContent(mNativePointer)];
|
||||
return YogaAlign.fromInt(jni_YGNodeStyleGetAlignContent(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaPositionType getPositionType() {
|
||||
return YogaPositionType.values()[jni_YGNodeStyleGetPositionType(mNativePointer)];
|
||||
return YogaPositionType.fromInt(jni_YGNodeStyleGetPositionType(mNativePointer));
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public YogaOverflow getOverflow() {
|
||||
return YogaOverflow.values()[jni_YGNodeStyleGetOverflow(mNativePointer)];
|
||||
return YogaOverflow.fromInt(jni_YGNodeStyleGetOverflow(mNativePointer));
|
||||
}
|
||||
|
||||
private native void jni_YGNodeStyleSetOverflow(long nativePointer, int overflow);
|
||||
@@ -310,6 +310,18 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
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);
|
||||
@Override
|
||||
public void setFlex(float flex) {
|
||||
@@ -623,7 +635,7 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
|
||||
@Override
|
||||
public YogaDirection getLayoutDirection() {
|
||||
return YogaDirection.values()[mLayoutDirection];
|
||||
return YogaDirection.fromInt(mLayoutDirection);
|
||||
}
|
||||
|
||||
private native void jni_YGNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
@@ -647,9 +659,9 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
||||
return mMeasureFunction.measure(
|
||||
this,
|
||||
width,
|
||||
YogaMeasureMode.values()[widthMode],
|
||||
YogaMeasureMode.fromInt(widthMode),
|
||||
height,
|
||||
YogaMeasureMode.values()[heightMode]);
|
||||
YogaMeasureMode.fromInt(heightMode));
|
||||
}
|
||||
|
||||
private native void jni_YGNodeSetHasBaselineFunc(long nativePointer, boolean hasMeasureFunc);
|
||||
|