2017-01-02 02:22:45 -08:00
|
|
|
/**
|
Fix Generation of Tests from Fixtures
Summary:
https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation.
I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in.
This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like).
The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files.
Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066
Reviewed By: rozele, Andrey-Mishanin
Differential Revision: D39907416
fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
2022-09-29 22:25:24 -07:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2017-01-02 02:22:45 -08:00
|
|
|
*
|
Fix Generation of Tests from Fixtures
Summary:
https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation.
I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in.
This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like).
The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files.
Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066
Reviewed By: rozele, Andrey-Mishanin
Differential Revision: D39907416
fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
2022-09-29 22:25:24 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-01-02 02:22:45 -08:00
|
|
|
*/
|
Fix Generation of Tests from Fixtures
Summary:
https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation.
I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in.
This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like).
The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files.
Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066
Reviewed By: rozele, Andrey-Mishanin
Differential Revision: D39907416
fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
2022-09-29 22:25:24 -07:00
|
|
|
|
2017-01-31 09:28:09 -08:00
|
|
|
// @Generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html
|
2017-01-02 02:22:45 -08:00
|
|
|
|
|
|
|
var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
|
|
|
|
|
|
|
|
it("absolute_layout_width_height_start_top", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_START, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child0.setWidth(10);
|
|
|
|
root_child0.setHeight(10);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_width_height_end_bottom", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_END, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root_child0.setWidth(10);
|
|
|
|
root_child0.setHeight(10);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_start_top_end_bottom", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_START, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_END, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_width_height_start_top_end_bottom", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_START, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_END, 10);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root_child0.setWidth(10);
|
|
|
|
root_child0.setHeight(10);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
|
|
|
it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
|
|
|
root.setOverflow(Yoga.OVERFLOW_HIDDEN);
|
|
|
|
root.setWidth(50);
|
|
|
|
root.setHeight(50);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_START, 0);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 0);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0_child0.setWidth(100);
|
|
|
|
root_child0_child0.setHeight(100);
|
|
|
|
root_child0.insertChild(root_child0_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(-50 === root_child0.getComputedLeft(), "-50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_within_border", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setMargin(Yoga.EDGE_LEFT, 10);
|
|
|
|
root.setMargin(Yoga.EDGE_TOP, 10);
|
|
|
|
root.setMargin(Yoga.EDGE_RIGHT, 10);
|
|
|
|
root.setMargin(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root.setPadding(Yoga.EDGE_LEFT, 10);
|
|
|
|
root.setPadding(Yoga.EDGE_TOP, 10);
|
|
|
|
root.setPadding(Yoga.EDGE_RIGHT, 10);
|
|
|
|
root.setPadding(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root.setBorder(Yoga.EDGE_LEFT, 10);
|
|
|
|
root.setBorder(Yoga.EDGE_TOP, 10);
|
|
|
|
root.setBorder(Yoga.EDGE_RIGHT, 10);
|
|
|
|
root.setBorder(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_LEFT, 0);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 0);
|
|
|
|
root_child0.setWidth(50);
|
|
|
|
root_child0.setHeight(50);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child1 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child1.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child1.setPosition(Yoga.EDGE_RIGHT, 0);
|
|
|
|
root_child1.setPosition(Yoga.EDGE_BOTTOM, 0);
|
|
|
|
root_child1.setWidth(50);
|
|
|
|
root_child1.setHeight(50);
|
|
|
|
root.insertChild(root_child1, 1);
|
2017-05-22 02:56:19 -07:00
|
|
|
|
|
|
|
var root_child2 = Yoga.Node.create(config);
|
|
|
|
root_child2.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child2.setPosition(Yoga.EDGE_LEFT, 0);
|
|
|
|
root_child2.setPosition(Yoga.EDGE_TOP, 0);
|
|
|
|
root_child2.setMargin(Yoga.EDGE_LEFT, 10);
|
|
|
|
root_child2.setMargin(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child2.setMargin(Yoga.EDGE_RIGHT, 10);
|
|
|
|
root_child2.setMargin(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root_child2.setWidth(50);
|
|
|
|
root_child2.setHeight(50);
|
|
|
|
root.insertChild(root_child2, 2);
|
|
|
|
|
|
|
|
var root_child3 = Yoga.Node.create(config);
|
|
|
|
root_child3.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child3.setPosition(Yoga.EDGE_RIGHT, 0);
|
|
|
|
root_child3.setPosition(Yoga.EDGE_BOTTOM, 0);
|
|
|
|
root_child3.setMargin(Yoga.EDGE_LEFT, 10);
|
|
|
|
root_child3.setMargin(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child3.setMargin(Yoga.EDGE_RIGHT, 10);
|
|
|
|
root_child3.setMargin(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root_child3.setWidth(50);
|
|
|
|
root_child3.setHeight(50);
|
|
|
|
root.insertChild(root_child3, 3);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(10 === root.getComputedLeft(), "10 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root.getComputedTop(), "10 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
|
|
console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
|
|
|
|
2017-05-22 02:56:19 -07:00
|
|
|
console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
|
|
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(10 === root.getComputedLeft(), "10 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root.getComputedTop(), "10 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
|
|
console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
2017-05-22 02:56:19 -07:00
|
|
|
|
|
|
|
console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
|
|
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");
|
|
|
|
console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");
|
|
|
|
console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");
|
2017-02-20 05:31:20 -08:00
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-02 02:22:45 -08:00
|
|
|
});
|
2017-01-26 13:36:39 -08:00
|
|
|
it("absolute_layout_align_items_and_justify_content_center", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_and_justify_content_flex_end", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_FLEX_END);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedTop(), "60 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedTop(), "60 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_justify_content_center", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_center", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_center_on_child_only", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setAlignSelf(Yoga.ALIGN_CENTER);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_LEFT, 5);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
|
|
|
it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () {
|
2017-03-28 10:28:53 -07:00
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
2017-02-20 05:31:20 -08:00
|
|
|
try {
|
2017-03-01 09:19:55 -08:00
|
|
|
var root = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
|
|
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
|
|
|
root.setFlexGrow(1);
|
|
|
|
root.setWidth(110);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
var root_child0 = Yoga.Node.create(config);
|
2017-02-20 05:31:20 -08:00
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_RIGHT, 5);
|
|
|
|
root_child0.setWidth(60);
|
|
|
|
root_child0.setHeight(40);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
2017-03-28 10:28:53 -07:00
|
|
|
|
|
|
|
config.free();
|
2017-02-20 05:31:20 -08:00
|
|
|
}
|
2017-01-26 13:36:39 -08:00
|
|
|
});
|
2017-04-11 13:00:02 -07:00
|
|
|
it("position_root_with_rtl_should_position_withoutdirection", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setPosition(Yoga.EDGE_LEFT, 72);
|
|
|
|
root.setWidth(52);
|
|
|
|
root.setHeight(52);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(72 === root.getComputedLeft(), "72 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(72 === root.getComputedLeft(), "72 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|
2017-05-22 02:56:19 -07:00
|
|
|
it("absolute_layout_percentage_bottom_based_on_parent_height", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(200);
|
|
|
|
|
|
|
|
var root_child0 = Yoga.Node.create(config);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setPosition(Yoga.EDGE_TOP, "50%");
|
|
|
|
root_child0.setWidth(10);
|
|
|
|
root_child0.setHeight(10);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
|
|
|
|
var root_child1 = Yoga.Node.create(config);
|
|
|
|
root_child1.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child1.setPosition(Yoga.EDGE_BOTTOM, "50%");
|
|
|
|
root_child1.setWidth(10);
|
|
|
|
root_child1.setHeight(10);
|
|
|
|
root.insertChild(root_child1, 1);
|
|
|
|
|
|
|
|
var root_child2 = Yoga.Node.create(config);
|
|
|
|
root_child2.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child2.setPosition(Yoga.EDGE_TOP, "10%");
|
|
|
|
root_child2.setPosition(Yoga.EDGE_BOTTOM, "10%");
|
|
|
|
root_child2.setWidth(10);
|
|
|
|
root.insertChild(root_child2, 2);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
|
|
console.assert(90 === root_child1.getComputedTop(), "90 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
|
|
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
|
|
console.assert(160 === root_child2.getComputedHeight(), "160 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(90 === root_child1.getComputedLeft(), "90 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");
|
|
|
|
console.assert(90 === root_child1.getComputedTop(), "90 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");
|
|
|
|
console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(90 === root_child2.getComputedLeft(), "90 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");
|
|
|
|
console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");
|
|
|
|
console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");
|
|
|
|
console.assert(160 === root_child2.getComputedHeight(), "160 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|
2017-05-29 07:50:43 -07:00
|
|
|
it("absolute_layout_in_wrap_reverse_column_container", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
|
|
|
var root_child0 = Yoga.Node.create(config);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(20);
|
|
|
|
root_child0.setHeight(20);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
it("absolute_layout_in_wrap_reverse_row_container", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
|
|
|
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
|
|
|
var root_child0 = Yoga.Node.create(config);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(20);
|
|
|
|
root_child0.setHeight(20);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|
2017-06-01 05:30:17 -07:00
|
|
|
it("absolute_layout_in_wrap_reverse_column_container_flex_end", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
|
|
|
var root_child0 = Yoga.Node.create(config);
|
|
|
|
root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(20);
|
|
|
|
root_child0.setHeight(20);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
it("absolute_layout_in_wrap_reverse_row_container_flex_end", function () {
|
|
|
|
var config = Yoga.Config.create();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var root = Yoga.Node.create(config);
|
|
|
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
|
|
|
root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE);
|
|
|
|
root.setWidth(100);
|
|
|
|
root.setHeight(100);
|
|
|
|
|
|
|
|
var root_child0 = Yoga.Node.create(config);
|
|
|
|
root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END);
|
|
|
|
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
|
|
|
root_child0.setWidth(20);
|
|
|
|
root_child0.setHeight(20);
|
|
|
|
root.insertChild(root_child0, 0);
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
|
|
|
|
|
|
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
|
|
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
|
|
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
|
|
|
|
|
|
|
console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
|
|
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
|
|
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
|
|
|
} finally {
|
|
|
|
if (typeof root !== "undefined") {
|
|
|
|
root.freeRecursive();
|
|
|
|
}
|
|
|
|
|
|
|
|
config.free();
|
|
|
|
}
|
|
|
|
});
|