Compare commits

..

50 Commits

Author SHA1 Message Date
Georgiy Kassabli
b5c2b09780 Revert D4456312: Fix for Yoga test failure for flexing with min stack dimension
Summary: This reverts commit 82a39bc93cf3bf2374b968e9f7403397e752908e

Differential Revision: D4456312

fbshipit-source-id: 6b396f0a8b67619308456599377238b75d0c1ab3
2017-02-07 05:18:19 -08:00
Antonio Corrado
46817a38c3 Setting min=max dimension is treated as setting dimension
Summary: If a node has minDimension and maxDimension set at the same value, yoga will treat it as having a set dimension, doing less calculations.

Reviewed By: emilsjolander

Differential Revision: D4492395

fbshipit-source-id: 3f4293548399e006aa808b9586d24e77c7df1f21
2017-02-06 14:41:37 -08:00
Georgiy Kassabli
52f3471405 Fix for Yoga test failure for flexing with min stack dimension
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size

Reviewed By: emilsjolander

Differential Revision: D4456312

fbshipit-source-id: 82a39bc93cf3bf2374b968e9f7403397e752908e
2017-02-06 13:00:42 -08:00
Lukas Wöhrl
e567502750 Added property display: flex and none
Summary:
Fix #241 and successor for #302

Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369

Reviewed By: astreet

Differential Revision: D4501141

Pulled By: emilsjolander

fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
2017-02-06 09:39:37 -08:00
Dustin Shahidehpour
c1cdc1de58 Fix warnings about icon assets.
Summary:
I incorrectly sized some assets, as a result, the sample project had some warnings about it when you built. This fixes it.
Closes https://github.com/facebook/yoga/pull/377

Differential Revision: D4515193

Pulled By: dshahidehpour

fbshipit-source-id: 3af6e79a17777bec3798bbf7294af5716f65e37a
2017-02-06 07:39:33 -08:00
Dustin Shahidehpour
f2c41f366f Made YogaKitSample build again, use cocoapods, add icon images.
Summary: The Sample app needed some love. It wouldn't build because of some import errors, adding files is very manual, and it looked bad. I have fixed all of these things.

Reviewed By: amonshiz

Differential Revision: D4508624

fbshipit-source-id: bda40defb167ef871d8d0d5bb853d8905b9682d8
2017-02-03 13:39:35 -08:00
Emil Sjolander
56d06e27cf Pass parent with down with calculateLayout to allow percentages on root node
Summary: For percentage paddings/margins/sizes to work on the root node we need to have the ability to pass down the parent sizes. This has always been possible with the C API but was never exposed to java. This diff exposes this functionality.

Reviewed By: astreet

Differential Revision: D4501016

fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
2017-02-03 11:24:57 -08:00
Emil Sjolander
93e327f4a5 Return raw edge style value now that we have layout outputs for them
Summary: Previously we needed to be able to return a computed value from the style edge getters to correctly handle things like RTL in frameworks such as React Native. However we now have a more correct solution with is to expose layout outputs for these edge values. This means we can go back to returning the raw value set for padding/margin/border like we do with other styles.

Reviewed By: astreet

Differential Revision: D4500892

fbshipit-source-id: e7c26bdda9ecbfc76b6cf1f384f8cf9f38284120
2017-02-03 11:24:57 -08:00
Dustin Shahidehpour
687668a4b3 Move podspec to root directory.
Summary: For our YogaKit sample project we want to add Cocoapods support and reference the local podspec. Unfortunately, this won't work unless the podspec lives in the root directory.

Reviewed By: emilsjolander

Differential Revision: D4507887

fbshipit-source-id: 919a8c8506768c90e50b3ae27deb51394db021e6
2017-02-03 10:24:55 -08:00
Emil Sjolander
cfeac79130 Fix percentage calculation when parent size is undefined
Summary: If parent size was undefined and node specified percentage size it would pass does an exact measure mode with an undefined value which broke an assertion.

Reviewed By: gkassabli

Differential Revision: D4494265

fbshipit-source-id: 9efef9e39a1b66af2d0f144575a96c919d60dbf7
2017-02-03 05:40:00 -08:00
Emil Sjolander
4227e36ca5 Add tests for wrapping to child size
Summary: Add tests for container wrapping child size

Reviewed By: gkassabli

Differential Revision: D4494263

fbshipit-source-id: bebfdd4a180b0ccd8dbb14e566613f1e64fabd7a
2017-02-03 05:40:00 -08:00
Emil Sjolander
be1c9f249e Take parent size into account when determining if style dim is defined
Summary: Ensure that a percentage size is only "defined" if the parent size is defined.

Reviewed By: gkassabli

Differential Revision: D4494258

fbshipit-source-id: 36c31444cbd113a820b067fe9e7b9560ae1d4df7
2017-02-03 05:40:00 -08:00
Lukas Wöhrl
511a129a7e Generate enums in sorted order
Summary:
This PR forces the order of the generated enums in alphabetically order. This is needed to have a predictable order of the enums across different python versions. Which reduces the pain for merging multiple enum additions.
Closes https://github.com/facebook/yoga/pull/370

Reviewed By: gkassabli

Differential Revision: D4501140

Pulled By: emilsjolander

fbshipit-source-id: 66c0ed9e4ea7a5990578b53b0a7e400c13dd53a9
2017-02-03 04:24:36 -08:00
Emil Sjolander
d62ca8c518 Use fromInt() instead of indexing values() as it allocates a new array
Summary: values() create a shallow copy of the underlying array every time as there are no immutable arrays in java. By using fromInt() we avoid this allocation.

Reviewed By: pasqualeanatriello

Differential Revision: D4494371

fbshipit-source-id: 11cff65114803e185bc67a96da0bf2a2c4a3e6d9
2017-02-02 15:39:33 -08:00
Pascal Hartig
30413265c7 Remove docs/CONTRIBUTING.md
Summary: Remove the outdated `CONTRIBUTING.md`.

Reviewed By: emilsjolander

Differential Revision: D4500973

fbshipit-source-id: 955395887330287f9973bfc21714a2c24c1fac2a
2017-02-02 05:54:39 -08:00
Pascal Hartig
bd5d8a77c9 Restore basedir format.sh behavior
Summary: Ensure that `format.sh` can be run from anywhere with the same results.

Reviewed By: emilsjolander

Differential Revision: D4494367

fbshipit-source-id: cbd2cc36476a0a54a77a732cbe1b79388f7e0c46
2017-02-01 02:39:33 -08:00
Pascal Hartig
326ae15532 Format C/C++ files
Summary: Run new `format.sh`.

Reviewed By: emilsjolander

Differential Revision: D4481501

fbshipit-source-id: 5791bee9919b44282d1549029ff8e078f253ddf8
2017-01-31 09:40:19 -08:00
Pascal Hartig
9afb65da34 Regenerate test comments
Reviewed By: emilsjolander

Differential Revision: D4482049

fbshipit-source-id: c30a6550ed175811df29c24ba03af92f3bd32713
2017-01-31 09:40:19 -08:00
Pascal Hartig
fe7643c84a Update gentest to match formatter
Reviewed By: emilsjolander

Differential Revision: D4482028

fbshipit-source-id: c6e1e0ecb0475fba62d25858c9e9960eab2701dc
2017-01-31 09:40:19 -08:00
Pascal Hartig
6daad3ae66 Update format.sh
Summary:
The format.sh was referring to an outdated `benchmarks/` directory and left out
a bunch of other C/C++ files. This updates it to cover all but the build
artifacts and vendored libraries in `lib/`.

Reviewed By: emilsjolander

Differential Revision: D4481490

fbshipit-source-id: 056e00359f794d0aa999fd65ec1ef0c657738867
2017-01-31 09:40:18 -08:00
Maël Nison
44590b8907 Updates the js build
Summary:
I've updated the js build. Let's see what Travis thinks of it!
Closes https://github.com/facebook/yoga/pull/365

Reviewed By: dshahidehpour

Differential Revision: D4488099

Pulled By: emilsjolander

fbshipit-source-id: d56ee2ccbfec84f766fcfdec9bcc9c5f610a6b0e
2017-01-31 08:39:32 -08:00
orta
4400b52aab Add support for showing the YogaKit README on CocoaPods.org
Summary:
Hey there, congrats on the launch - we use React Native at Artsy, and I've been wondering about what Yoga + Jest Snapshots for RN looks like but haven't had the time to explore that yet.

With https://github.com/CocoaPods/cocoadocs.org/pull/501 I added the ability to customize the location of the README for the front-page of the CocoaPods site. That is being deployed as I speak, so it should be available the next time you decide to ship a version of Yoga.

I also fixed the capitalisation of CocoaPods, and removed a redundant CocoaPods badge on your initial README.
Closes https://github.com/facebook/yoga/pull/366

Reviewed By: emilsjolander

Differential Revision: D4488011

Pulled By: dshahidehpour

fbshipit-source-id: 6c0c4efc23a69e1fcb936214b159b49217218b49
2017-01-31 07:39:45 -08:00
Dustin Shahidehpour
c217553cf8 Add README.md
Summary: This gives YogaKit its' own readme. #accept2ship

Reviewed By: emilsjolander

Differential Revision: D4482411

fbshipit-source-id: 24ddab586d9a12a8419ae8811fa4d03b27c1a19e
2017-01-30 11:09:45 -08:00
Emil Sjolander
6ad5003149 Align Yoga and YogaKit pod specs
Summary: Make the two podspecs more consistent with each other.

Reviewed By: dshahidehpour

Differential Revision: D4481945

fbshipit-source-id: ab782abecd709c763b4e931b6839a5cae6346281
2017-01-30 08:54:35 -08:00
Lukas Wöhrl
7c77b0e48c Fix syntax error in YGMarginTest.html
Summary:
Fixes wrongly used  ```;``` inside style declaration.
Closes https://github.com/facebook/yoga/pull/360

Reviewed By: astreet

Differential Revision: D4476067

Pulled By: emilsjolander

fbshipit-source-id: 332cdcd9a832eebc68a6d73840c1d5a10078eb66
2017-01-30 08:39:35 -08:00
Dustin Shahidehpour
7b36118df4 Add issue template.
Summary: When people file issues, they are (in-general) missing a lot of useful information. This template will now be included when people file issues. More info here: https://github.com/blog/2111-issue-and-pull-request-templates

Reviewed By: emilsjolander

Differential Revision: D4481713

fbshipit-source-id: 8c173e282438d5156d50fe40c581e18730d6a5af
2017-01-30 07:39:38 -08:00
Dustin Shahidehpour
7f0dbe5356 Add deployment target to podspec.
Summary: Without specifying the deployment target, it was default to iOS 4.3. This would cause a build error because we are `unable to synthesize weak properties` which didn't come around until iOS 5. Setting default target to iOS 8.

Reviewed By: emilsjolander

Differential Revision: D4481772

fbshipit-source-id: d3be88d0f73533c6242fc1d9045c70ad4628fd21
2017-01-30 07:39:38 -08:00
Maël Nison
b87fc217df Silents errors when running copy-sources
Summary:
Being a environment test, `npm run is-monolithic` is expected to fail when pulling the package from npm and to succeed when pulling it from github. Unfortunately, when returning false, npm will throw a tantrum by default if not explicitely disabled. It's not a hard failure, the build still complete, but it's better this way.
Closes https://github.com/facebook/yoga/pull/362

Reviewed By: gkassabli

Differential Revision: D4480608

Pulled By: emilsjolander

fbshipit-source-id: 0832a2158647f49b5230e2f658997f94774cec5b
2017-01-30 06:24:33 -08:00
Emil Sjolander
625dc4bf44 Version bump
Summary: Bump version and publish to npm + cocoapods

Reviewed By: dshahidehpour

Differential Revision: D4479027

fbshipit-source-id: 42aa81de1a5a07e3a2814670ad1cf3774519b353
2017-01-28 11:09:35 -08:00
Rui Marinho
34736a4929 Add Xamarin Android support
Summary:
Adds a Xamarin Android support for Yoga and respective tests. Closes #276 with this PR all Xamarin platforms will be covered

Need to figure a better strategy for the build names for buck with splhack .

It's failing 3 tests related with YogaNode and the GC :) classic!

![screenshot_1484353863](https://cloud.githubusercontent.com/assets/1235097/21950981/61020212-d9f8-11e6-80e1-185bd1707f9a.png)

```
Facebook.Yoga.Android.Tests.dll : 660.87 ms
 : 678.788 ms
Tests run: 130, Passed: 127, Failed: 3, Skipped: 0, Inconclusive: 0
```
Closes https://github.com/facebook/yoga/pull/340

Reviewed By: emilsjolander

Differential Revision: D4475370

Pulled By: splhack

fbshipit-source-id: f050f10415e68e9808f629b843682b0f87cca065
2017-01-27 17:54:34 -08:00
Emil Sjolander
4f37cde043 re-generate js build
Summary: npm run build:all

Reviewed By: dshahidehpour

Differential Revision: D4477027

fbshipit-source-id: 107e13134145df18a788e079be467b27d1893118
2017-01-27 14:24:40 -08:00
Guido Marucci Blas
7df60376ff CocoaPods support.
Summary:
This supersedes #309 and #305.

This is still a **work-in-progress.**

**TODO**

 - [x] Create Xcode project that builds an iOS framework
 - [x] Fix failing tests on Xcode
 - [ ] Make `pod lib lint` pass and make sure YogaKit can be included using CocoaPods
 - [ ] Add `pod lib lint` to .travis.yml
 - [x] Migrate to travis osx image with Xcode 8.2

**FOLLOW-UP**
  - [ ] Make YogaKitSample use framework built by new Xcode project.
  - [ ] Make Travis to upload prebuilt versions of the framework. More [here](https://github.com/Carthage/Carthage#use-travis-ci-to-upload-your-tagged-prebuild-frameworks)
  - [ ] Upgrade github/jekyll docs about installation using Cocoapods/Carthage
Closes https://github.com/facebook/yoga/pull/352

Reviewed By: emilsjolander

Differential Revision: D4471950

Pulled By: dshahidehpour

fbshipit-source-id: 8f30c69f9a487b26aa2e5f3b66841334b01b0ab1
2017-01-27 10:09:48 -08:00
Emil Sjolander
7fa4adb0d9 Fix aspectratio with margins
Summary: aspect ratio did not account for the widths and heights being including padding. This diff fixes that.

Reviewed By: astreet

Differential Revision: D4473024

fbshipit-source-id: 5a747e2f267b077203bb3b63e4c152847dc30774
2017-01-27 10:09:48 -08:00
Kazuki Sakamoto
abb91ae77b Remove deprecated code
Summary: - Remove classes and methods marked as `Obsolete`

Reviewed By: emilsjolander

Differential Revision: D4474945

fbshipit-source-id: 43552fa638c8b321603858a862a386c5296db2fa
2017-01-27 09:09:36 -08:00
Dustin Shahidehpour
a4b1ac83f4 Update README.md to include Pod Shield
Summary: Closes https://github.com/facebook/yoga/pull/356

Differential Revision: D4471126

Pulled By: dshahidehpour

fbshipit-source-id: 362a92225c8267cb89b12b45a98f69adf726c42d
2017-01-26 14:40:07 -08:00
Emil Sjolander
8775cdc13f Format and run codegen
Summary: run format & gentest scripts. Some of the javascript tests had not been generated recently by the looks of it.

Reviewed By: dshahidehpour

Differential Revision: D4459455

fbshipit-source-id: fc1eca58fe897c8f4a2571638b4f7035d023b479
2017-01-26 13:39:42 -08:00
Maël Nison
db732ce9fa Add YGLayoutGetBorder, counterpart of YGLayoutGetPadding
Summary:
Followup of #335, fix #326. This commit add the `YGLayoutGetBorder(node, edge)` function, which correctly takes RTL/LTR into account when resolving `EDGE_START` & `EDGE_END`.
Closes https://github.com/facebook/yoga/pull/344

Reviewed By: dshahidehpour

Differential Revision: D4459950

Pulled By: emilsjolander

fbshipit-source-id: b57eb7a5b1c181a364913c3200a3794a2b7b31a6
2017-01-26 13:39:42 -08:00
Lukas Wöhrl
7c09244c39 Fix absolute position if align-item or justify-content is center or flex-end
Summary:
Fix #310 (```center```)

additionally fixes if ```flex-end``` is set.
Closes https://github.com/facebook/yoga/pull/349

Reviewed By: dshahidehpour

Differential Revision: D4458528

Pulled By: emilsjolander

fbshipit-source-id: f073c80bfc3ea6675cb95b00283074d10e91a042
2017-01-26 13:39:41 -08:00
Dustin Shahidehpour
2cc2a5f2ff Add podspec for C-Library.
Summary: This is the first step to adding cocoapods support to YogaKit. We are going to publish a `Yoga` framework to the store that we can use as a dependency. This will also allow developers to build their own abstractions easily using the core API.

Reviewed By: nlutsenko, emilsjolander

Differential Revision: D4466788

fbshipit-source-id: 8f08bdbf524e57c88f7fc3400c4ba6ad58f98d7f
2017-01-26 10:39:36 -08:00
Lukas Wöhrl
e4b50f2a8d Fix unnecessary measure calls
Summary:
Fix #334
Closes https://github.com/facebook/yoga/pull/347

Reviewed By: dshahidehpour

Differential Revision: D4455438

Pulled By: emilsjolander

fbshipit-source-id: 013c89e71757d9048708ec85cbb6af9f33ac1ea6
2017-01-24 19:09:32 -08:00
Emil Sjolander
a2a84532ff Dont constrain absolute children to zero sized parents
Summary: Absolute children should not be constraint to the size of their parent if the parent does not have a size as this was causes the layout of the child to be skipped.

Reviewed By: gkassabli

Differential Revision: D4453612

fbshipit-source-id: e8269521560d2f42b2d6f0f0ff264a1605a57d79
2017-01-24 17:09:34 -08:00
Emil Sjolander
d391323129 Use findClassStatic instead of findClassLocal
Summary: We are saving the class reference in a static variable to should be using findClassStatic to ensure the reference is always valid.

Reviewed By: mhorowitz

Differential Revision: D4420352

fbshipit-source-id: 8c66c1b2213fe295334a9bdc4e1dd7e1a4285aae
2017-01-24 15:54:31 -08:00
David Hart
ab28ecf31b Improve test readability
Summary:
I did some stylistic changes to the Objective-C unit tests for the following reasons:

- When an equality assert fails, the error messages reads as if the value we are testing is the first argument and the value we expect is the second argument. To improve the readability of test messages, I made sure all `XCTAssertEqual` and `XCTAssertNotEqual` have the arguments in the correct order.

- Because failing equality asserts already comes with a detailed message including the value tested and the expected value, I rewrote several truth asserts on `CGSizeEqual` to two equality asserts on the width and height: when those fail, the error message are clearer.
Closes https://github.com/facebook/yoga/pull/351

Reviewed By: emilsjolander

Differential Revision: D4454484

Pulled By: dshahidehpour

fbshipit-source-id: 0c1295a4a7e8477eacfb3f4ef6648984fd102a51
2017-01-24 10:09:32 -08:00
Dustin Shahidehpour
a4bab68802 Make YogaKit tests pass whether they are run in Xcode or BUCK.
Summary: Currently, some YogaKit tests fail when they are run in Xcode, but pass in BUCK. This cleans up the tests so that they more definitively test what they say they are testing, and the results are not affected by the enviroment they are run in.

Reviewed By: emilsjolander

Differential Revision: D4453745

fbshipit-source-id: 238e41960afe63d31e9f6efdcd947cfac39f2dc4
2017-01-23 19:39:37 -08:00
Dustin Shahidehpour
e3cfacf0cb Upgrade Travis to Xcode 8.2
Summary:
Doing this externally to trigger a Travis build. This will put our Travis infra on the newest Xcode.
Closes https://github.com/facebook/yoga/pull/353

Reviewed By: emilsjolander

Differential Revision: D4453795

Pulled By: dshahidehpour

fbshipit-source-id: 23416405fdd43486c934bea0b720c217fafd7f30
2017-01-23 19:39:37 -08:00
Ahmed El-Helw
8d74e01f41 Fix typo in generated Yoga classes
Reviewed By: emilsjolander

Differential Revision: D4416273

fbshipit-source-id: fa3f87b86560121e1186cdc0ee295eb052fb3a97
2017-01-19 16:24:33 -08:00
David Hart
5404bb13d4 Fix bugs introduced with YogaKit improvements
Summary:
I'm trying to fix some bugs I introduced in my latest PR, but while writing the Unit Tests for them, I saw a really weird behaviour. The following exact piece of code WORKS inside a Yoga C++ unit test, but fails from a Objective-C unit test. I had me completely confused and blocked me in my progression. Any ideas?

```
TEST(YogaTest, stupid_test) {
  const YGNodeRef node = YGNodeNew();
  YGNodeStyleSetPosition(node, YGEdgeLeft, 1);

  ASSERT_FLOAT_EQ(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value);
  ASSERT_EQ(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit);

  YGNodeFree(node);
}

```

```
- (void)testPositionalPropertiesWork
{
  YGNodeRef node = YGNodeNew();
  YGNodeStyleSetPosition(node, YGEdgeLeft, 1);

  XCTAssertEqual(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value);
  XCTAssertEqual(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit);

  YGNodeFree(node);
}
```
Closes https://github.com/facebook/yoga/pull/328

Reviewed By: dshahidehpour

Differential Revision: D4421504

Pulled By: emilsjolander

fbshipit-source-id: f59379edf70aee87a77cd1ad2986313cdfe71b94
2017-01-18 09:24:35 -08:00
Lukas Woehrl
be8773fee0 Fix wraping calculation if min-size constraint exists
Summary:
Fixes #261
Closes https://github.com/facebook/css-layout/pull/262

Reviewed By: splhack

Differential Revision: D4245200

Pulled By: emilsjolander

fbshipit-source-id: 77d802d71010ed426511d6a01e6de1e7c9194179
2017-01-16 16:24:35 -08:00
Emil Sjolander
0bcec80dfe BREAKING - Fix sizing of container with child overflowing parent
Summary:
Fixes issue brought up in https://github.com/facebook/react-native/issues/10603

The gist of the problem is that in css it is fine for a child to overflow a parent if it feels the need to, we were not respecting this.

Reviewed By: mmmulani

Differential Revision: D4182141

fbshipit-source-id: c73fd15d2577ab846fc8a202d529d0e6e1207b75
2017-01-16 11:09:32 -08:00
Thanabodee Charoenpiriyakij
2c8c2bffda Edit README.md in Benchmarks section
Summary:
Benchmarks are not located in folder benchmark. So rename folder
and buck target from 'benchmarks' to 'benchmark'.
Closes https://github.com/facebook/yoga/pull/339

Reviewed By: gkassabli

Differential Revision: D4420355

Pulled By: emilsjolander

fbshipit-source-id: 7a1bc6ece7f4b64c7cac506357e265c1b4790a4f
2017-01-16 10:39:37 -08:00
183 changed files with 8336 additions and 1689 deletions

17
.github/ISSUE_TEMPLATE.md vendored Normal file
View 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
View File

@@ -0,0 +1 @@
3.0

View File

@@ -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

View File

@@ -1,4 +1,4 @@
# Yoga [![Build Status](https://travis-ci.org/facebook/yoga.svg?branch=master)](https://travis-ci.org/facebook/yoga)
# Yoga [![Build Status](https://travis-ci.org/facebook/yoga.svg?branch=master)](https://travis-ci.org/facebook/yoga) [![CocoaPods](https://img.shields.io/cocoapods/v/YogaKit.svg)](http://cocoapods.org/pods/YogaKit) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](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
View 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
View 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
View File

@@ -0,0 +1 @@
3.0.2

View File

@@ -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
View File

@@ -0,0 +1,22 @@
# YogaKit
[![CocoaPods](https://img.shields.io/cocoapods/v/YogaKit.svg?style=flat)](https://cocoapods.org/pods/YogaKit)
[![Platform](https://img.shields.io/badge/platforms-iOS-orange.svg)](https://facebook.github.io/yoga/docs/api/yogakit/)
[![Languages](https://img.shields.io/badge/languages-ObjC%20%7C%20Swift-orange.svg)](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.

View File

@@ -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)

View File

@@ -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;

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
use_frameworks!
target 'YogaKitSample' do
pod 'YogaKit', :path => '../../YogaKit.podspec'
end

View 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

View File

@@ -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 */;

View 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>

View File

@@ -13,4 +13,3 @@
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -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"
}
],

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -7,6 +7,7 @@
*/
import UIKit
import YogaKit
class SwiftViewController: UIViewController {
override func viewDidLoad() {

View File

@@ -10,6 +10,4 @@
@interface ViewController : UIViewController
@end

View File

@@ -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>

View File

@@ -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,

View File

@@ -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
View File

@@ -0,0 +1 @@
lib/

View File

@@ -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>

View 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);
}
}
}

View File

@@ -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>

View 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

View File

@@ -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>

View File

@@ -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>

View 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;
}
}
}

View File

@@ -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>

View File

@@ -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);

View 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 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;
}
}
}

View 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,
}
}

View File

@@ -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;
}
}
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View 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);
}
}
}

View 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);
}
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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;

View 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);
}
}
}

View File

@@ -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`

View File

@@ -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')

View File

@@ -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

View File

@@ -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>

View 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>

View 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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View 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>

View File

@@ -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) + ');');
}},

View File

@@ -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) + ';');
}},

View File

@@ -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);');
}},

View File

@@ -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) + ');');
}},

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View 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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);

Some files were not shown because too many files have changed in this diff Show More