Compare commits
8 Commits
dependabot
...
v3.0.1
Author | SHA1 | Date | |
---|---|---|---|
|
17450191c3 | ||
|
75e564d0d5 | ||
|
e82479e4ca | ||
|
508b9a57fe | ||
|
749b6b2bf8 | ||
|
fe7dc21eb1 | ||
|
59fb251edc | ||
|
efbebb4a97 |
217
.clang-tidy
217
.clang-tidy
@@ -1,217 +0,0 @@
|
||||
---
|
||||
InheritParentConfig: true
|
||||
Checks: '>
|
||||
bugprone-argument-comment,
|
||||
bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-exception-escape,
|
||||
bugprone-fold-init-type,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-forwarding-reference-overload,
|
||||
bugprone-incorrect-enable-if,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-infinite-loop,
|
||||
bugprone-integer-division,
|
||||
bugprone-macro-parentheses,
|
||||
bugprone-macro-repeated-side-effects,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-optional-value-conversion,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-redundant-branch-condition,
|
||||
bugprone-shared-ptr-array-mismatch,
|
||||
bugprone-signed-char-misuse,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-swapped-arguments,
|
||||
bugprone-terminating-continue,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unique-ptr-array-mismatch,
|
||||
bugprone-unsafe-functions,
|
||||
bugprone-unused-raii,
|
||||
bugprone-unused-return-value,
|
||||
bugprone-use-after-move,
|
||||
bugprone-virtual-near-miss,
|
||||
clang-analyzer-apiModeling.google.GTest,
|
||||
clang-analyzer-apiModeling.StdCLibraryFunctions,
|
||||
clang-analyzer-apiModeling.TrustNonnull,
|
||||
clang-analyzer-core.builtin.BuiltinFunctions,
|
||||
clang-analyzer-core.builtin.NoReturnFunctions,
|
||||
clang-analyzer-core.CallAndMessage,
|
||||
clang-analyzer-core.DivideZero,
|
||||
clang-analyzer-core.DynamicTypePropagation,
|
||||
clang-analyzer-core.NonnilStringConstants,
|
||||
clang-analyzer-core.NonNullParamChecker,
|
||||
clang-analyzer-core.NullDereference,
|
||||
clang-analyzer-core.StackAddressEscape,
|
||||
clang-analyzer-core.UndefinedBinaryOperatorResult,
|
||||
clang-analyzer-core.uninitialized.ArraySubscript,
|
||||
clang-analyzer-core.uninitialized.Assign,
|
||||
clang-analyzer-core.uninitialized.Branch,
|
||||
clang-analyzer-core.uninitialized.CapturedBlockVariable,
|
||||
clang-analyzer-core.uninitialized.UndefReturn,
|
||||
clang-analyzer-core.VLASize,
|
||||
clang-analyzer-cplusplus.InnerPointer,
|
||||
clang-analyzer-cplusplus.Move,
|
||||
clang-analyzer-cplusplus.NewDelete,
|
||||
clang-analyzer-cplusplus.NewDeleteLeaks,
|
||||
clang-analyzer-cplusplus.SelfAssignment,
|
||||
clang-analyzer-deadcode.DeadStores,
|
||||
clang-analyzer-nullability.NullableDereferenced,
|
||||
clang-analyzer-nullability.NullablePassedToNonnull,
|
||||
clang-analyzer-nullability.NullableReturnedFromNonnull,
|
||||
clang-analyzer-nullability.NullPassedToNonnull,
|
||||
clang-analyzer-nullability.NullReturnedFromNonnull,
|
||||
clang-analyzer-optin.cplusplus.VirtualCall,
|
||||
clang-analyzer-optin.mpi.MPI-Checker,
|
||||
clang-analyzer-optin.performance.GCDAntipattern,
|
||||
clang-analyzer-optin.performance.Padding,
|
||||
clang-analyzer-optin.portability.UnixAPI,
|
||||
clang-analyzer-security.FloatLoopCounter,
|
||||
clang-analyzer-security.insecureAPI.bcmp,
|
||||
clang-analyzer-security.insecureAPI.bcopy,
|
||||
clang-analyzer-security.insecureAPI.bzero,
|
||||
clang-analyzer-security.insecureAPI.getpw,
|
||||
clang-analyzer-security.insecureAPI.gets,
|
||||
clang-analyzer-security.insecureAPI.mkstemp,
|
||||
clang-analyzer-security.insecureAPI.mktemp,
|
||||
clang-analyzer-security.insecureAPI.rand,
|
||||
clang-analyzer-security.insecureAPI.strcpy,
|
||||
clang-analyzer-security.insecureAPI.UncheckedReturn,
|
||||
clang-analyzer-security.insecureAPI.vfork,
|
||||
clang-analyzer-unix.API,
|
||||
clang-analyzer-unix.cstring.BadSizeArg,
|
||||
clang-analyzer-unix.cstring.NullArg,
|
||||
clang-analyzer-unix.Malloc,
|
||||
clang-analyzer-unix.MallocSizeof,
|
||||
clang-analyzer-unix.MismatchedDeallocator,
|
||||
clang-analyzer-unix.Vfork,
|
||||
clang-analyzer-valist.CopyToSelf,
|
||||
clang-analyzer-valist.Uninitialized,
|
||||
clang-analyzer-valist.Unterminated,
|
||||
clang-diagnostic-*,
|
||||
cppcoreguidelines-avoid-const-or-ref-data-members,
|
||||
cppcoreguidelines-avoid-non-const-global-variables,
|
||||
cppcoreguidelines-init-variables,
|
||||
cppcoreguidelines-interfaces-global-init,
|
||||
cppcoreguidelines-macro-usage,
|
||||
cppcoreguidelines-missing-std-forward,
|
||||
cppcoreguidelines-narrowing-conversions,
|
||||
cppcoreguidelines-no-malloc,
|
||||
cppcoreguidelines-prefer-member-initializer,
|
||||
cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
cppcoreguidelines-pro-type-const-cast,
|
||||
cppcoreguidelines-pro-type-cstyle-cast,
|
||||
cppcoreguidelines-pro-type-member-init,
|
||||
cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
cppcoreguidelines-pro-type-union-access,
|
||||
cppcoreguidelines-pro-type-vararg,
|
||||
cppcoreguidelines-slicing,
|
||||
cppcoreguidelines-special-member-functions,
|
||||
facebook-hte-BadEnum,
|
||||
facebook-hte-MissingStatic,
|
||||
google-build-using-namespace,
|
||||
misc-definitions-in-headers,
|
||||
misc-header-include-cycle,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
misc-non-copyable-objects,
|
||||
misc-static-assert,
|
||||
misc-throw-by-value-catch-by-reference,
|
||||
misc-unconventional-assign-operator,
|
||||
misc-uniqueptr-reset-release,
|
||||
misc-unused-alias-decls,
|
||||
misc-unused-parameters,
|
||||
misc-unused-using-decls,
|
||||
modernize-avoid-bind,
|
||||
modernize-avoid-c-arrays,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-deprecated-headers,
|
||||
modernize-deprecated-ios-base-aliases,
|
||||
modernize-loop-convert,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-pass-by-value,
|
||||
modernize-raw-string-literal,
|
||||
modernize-redundant-void-arg,
|
||||
modernize-replace-auto-ptr,
|
||||
modernize-replace-random-shuffle,
|
||||
modernize-return-braced-init-list,
|
||||
modernize-shrink-to-fit,
|
||||
modernize-unary-static-assert,
|
||||
modernize-use-auto,
|
||||
modernize-use-bool-literals,
|
||||
modernize-use-constraints,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-designated-initializers,
|
||||
modernize-use-emplace,
|
||||
modernize-use-equals-default,
|
||||
modernize-use-equals-delete,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-starts-ends-with,
|
||||
modernize-use-transparent-functors,
|
||||
modernize-use-using,
|
||||
performance-faster-string-find,
|
||||
performance-for-range-copy,
|
||||
performance-implicit-conversion-in-loop,
|
||||
performance-inefficient-algorithm,
|
||||
performance-inefficient-string-concatenation,
|
||||
performance-inefficient-vector-operation,
|
||||
performance-move-const-arg,
|
||||
performance-move-constructor-init,
|
||||
performance-noexcept-move-constructor,
|
||||
performance-type-promotion-in-math-fn,
|
||||
performance-unnecessary-copy-initialization,
|
||||
performance-unnecessary-value-param,
|
||||
readability-avoid-const-params-in-decls,
|
||||
readability-braces-around-statements,
|
||||
readability-const-return-type,
|
||||
readability-container-size-empty,
|
||||
readability-delete-null-pointer,
|
||||
readability-deleted-default,
|
||||
readability-implicit-bool-conversion,
|
||||
readability-inconsistent-declaration-parameter-name,
|
||||
readability-isolate-declaration,
|
||||
readability-misplaced-array-index,
|
||||
readability-named-parameter,
|
||||
readability-non-const-parameter,
|
||||
readability-redundant-control-flow,
|
||||
readability-redundant-declaration,
|
||||
readability-redundant-function-ptr-dereference,
|
||||
readability-redundant-preprocessor,
|
||||
readability-redundant-smartptr-get,
|
||||
readability-redundant-string-cstr,
|
||||
readability-redundant-string-init,
|
||||
readability-simplify-boolean-expr,
|
||||
readability-simplify-subscript-expr,
|
||||
readability-static-accessed-through-instance,
|
||||
readability-static-definition-in-anonymous-namespace,
|
||||
readability-string-compare,
|
||||
readability-uniqueptr-delete-release,
|
||||
'
|
||||
|
||||
CheckOptions:
|
||||
- key: performance-unnecessary-value-param.AllowedTypes
|
||||
value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$;'
|
||||
- key: performance-unnecessary-copy-initialization.AllowedTypes
|
||||
value: '[Pp]ointer$;[Pp]tr$;[Rr]ef(erence)?$'
|
||||
|
||||
...
|
@@ -9,7 +9,12 @@
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
ignorePatterns: ['**/binaries/**', '**/build/**', '**/generated/**'],
|
||||
ignorePatterns: [
|
||||
'/website',
|
||||
'**/binaries/**',
|
||||
'**/build/**',
|
||||
'**/generated/**',
|
||||
],
|
||||
overrides: [
|
||||
// Catch-all
|
||||
{
|
||||
|
2
.github/actions/setup-js/action.yml
vendored
2
.github/actions/setup-js/action.yml
vendored
@@ -6,7 +6,7 @@ runs:
|
||||
- name: Setup Node environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 18.x
|
||||
cache: yarn
|
||||
cache-dependency-path: yarn.lock
|
||||
env:
|
||||
|
23
.github/actions/setup-website/action.yml
vendored
Normal file
23
.github/actions/setup-website/action.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Setup Website envirionment
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# TODO: Update to latest when website is moved to the workspace version of
|
||||
# yoga-layout
|
||||
- name: Setup Node environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12.x
|
||||
cache: yarn
|
||||
cache-dependency-path: website/yarn.lock
|
||||
env:
|
||||
# https://github.com/actions/setup-node/issues/317
|
||||
FORCE_COLOR: 0
|
||||
|
||||
# TODO: the website should be in a yarn workspace with the library, but the
|
||||
# current version of gatsby is incompatible with hoisting.
|
||||
- name: yarn install
|
||||
shell: bash
|
||||
run: yarn install --frozen-lockfile --network-timeout 1000000
|
||||
working-directory: website
|
35
.github/workflows/publish-website.yml
vendored
Normal file
35
.github/workflows/publish-website.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Publish Website
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish to GitHub Pages
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup-website
|
||||
|
||||
- name: yarn build
|
||||
run: yarn build
|
||||
working-directory: website
|
||||
|
||||
- uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_branch: gh-pages
|
||||
publish_dir: website/public
|
||||
cname: yogalayout.dev
|
||||
keep_files: true
|
||||
user_name: 'Yoga-bot'
|
||||
user_email: 'yogabot@fb.com'
|
1
.github/workflows/validate-tests.yml
vendored
1
.github/workflows/validate-tests.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'release-*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
20
.github/workflows/validate-website.yml
vendored
20
.github/workflows/validate-website.yml
vendored
@@ -10,8 +10,22 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build [Gatsby]
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup
|
||||
uses: ./.github/actions/setup-website
|
||||
|
||||
- name: yarn build
|
||||
run: yarn build
|
||||
working-directory: website
|
||||
|
||||
build_next:
|
||||
name: Build
|
||||
name: Build [Docusaurus]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -25,7 +39,7 @@ jobs:
|
||||
|
||||
- name: Build Website
|
||||
run: yarn build
|
||||
working-directory: website
|
||||
working-directory: website-next
|
||||
|
||||
typecheck:
|
||||
name: Typecheck [Docusaurus]
|
||||
@@ -39,4 +53,4 @@ jobs:
|
||||
|
||||
- name: yarn tsc
|
||||
run: yarn tsc
|
||||
working-directory: website
|
||||
working-directory: website-next
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Yoga [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga) 
|
||||
# Yoga [](https://opensource.fb.com/support-ukraine) [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga)
|
||||
|
||||
Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages.
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'Yoga'
|
||||
spec.version = '0.0.0'
|
||||
spec.version = '3.0.1'
|
||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||
spec.homepage = 'https://yogalayout.dev/'
|
||||
spec.documentation_url = 'https://yogalayout.dev/docs'
|
||||
|
@@ -21,9 +21,9 @@ namespace facebook::yoga {
|
||||
using namespace nlohmann;
|
||||
using namespace std::chrono;
|
||||
|
||||
constexpr uint32_t kNumRepetitions = 100;
|
||||
constexpr uint32_t kNumRepititions = 100;
|
||||
using SteadyClockDurations =
|
||||
std::array<steady_clock::duration, kNumRepetitions>;
|
||||
std::array<steady_clock::duration, kNumRepititions>;
|
||||
|
||||
static bool inputsMatch(
|
||||
float actualWidth,
|
||||
@@ -46,11 +46,6 @@ static bool inputsMatch(
|
||||
actualHeightMode == expectedHeightMode;
|
||||
}
|
||||
|
||||
YGSize defaultMeasureFunctionResult() {
|
||||
std::cout << "Trying to measure a node that wasn't serialized" << std::endl;
|
||||
return {10.0, 10.0};
|
||||
}
|
||||
|
||||
YGSize mockMeasureFunc(
|
||||
YGNodeConstRef node,
|
||||
float availableWidth,
|
||||
@@ -58,34 +53,42 @@ YGSize mockMeasureFunc(
|
||||
float availableHeight,
|
||||
YGMeasureMode heightMode) {
|
||||
(void)node;
|
||||
auto fnsPtr = static_cast<SerializedMeasureFuncMap*>(YGNodeGetContext(node));
|
||||
MeasureFuncVecWithIndex* fns =
|
||||
static_cast<MeasureFuncVecWithIndex*>(YGNodeGetContext(node));
|
||||
|
||||
if (fnsPtr == nullptr) {
|
||||
return defaultMeasureFunctionResult();
|
||||
if (fns->index >= fns->vec.size()) {
|
||||
std::cout << "Extra measure function call made" << std::endl;
|
||||
return {10.0, 10.0};
|
||||
}
|
||||
|
||||
auto fnsIt = fnsPtr->find(node);
|
||||
if (fnsIt == fnsPtr->end()) {
|
||||
return defaultMeasureFunctionResult();
|
||||
}
|
||||
auto values = fns->vec.at(fns->index);
|
||||
|
||||
for (auto measureFunc : fnsIt->second) {
|
||||
if (inputsMatch(
|
||||
if (!inputsMatch(
|
||||
availableWidth,
|
||||
measureFunc.inputWidth,
|
||||
values.inputWidth,
|
||||
availableHeight,
|
||||
measureFunc.inputHeight,
|
||||
values.inputHeight,
|
||||
widthMode,
|
||||
measureFunc.widthMode,
|
||||
values.widthMode,
|
||||
heightMode,
|
||||
measureFunc.heightMode)) {
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::nanoseconds(measureFunc.durationNs));
|
||||
return {measureFunc.outputWidth, measureFunc.outputHeight};
|
||||
}
|
||||
values.heightMode)) {
|
||||
std::cout << "Measure function input mismatch." << std::endl
|
||||
<< "Expected width: " << values.inputWidth
|
||||
<< ", actual width: " << availableWidth << std::endl
|
||||
<< "Expected height: " << values.inputHeight
|
||||
<< ", actual height: " << availableHeight << std::endl
|
||||
<< "Expected width mode: " << values.widthMode
|
||||
<< ", actual width mode: " << widthMode << std::endl
|
||||
<< "Expected height mode: " << values.heightMode
|
||||
<< ", actual height mode: " << heightMode << std::endl;
|
||||
return {10.0, 10.0};
|
||||
}
|
||||
|
||||
return defaultMeasureFunctionResult();
|
||||
fns->index++;
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::nanoseconds(values.durationNs));
|
||||
|
||||
return {values.outputWidth, values.outputHeight};
|
||||
}
|
||||
|
||||
std::shared_ptr<const YGConfig> buildConfigFromJson(const json& j) {
|
||||
@@ -113,8 +116,8 @@ std::shared_ptr<const YGConfig> buildConfigFromJson(const json& j) {
|
||||
}
|
||||
|
||||
std::string edgeStringFromPropertyName(
|
||||
const std::string& key,
|
||||
const std::string& propertyName) {
|
||||
std::string key,
|
||||
std::string propertyName) {
|
||||
return key.substr(propertyName.length() + 1);
|
||||
}
|
||||
|
||||
@@ -254,7 +257,7 @@ void setStylesFromJson(const json& j, YGNodeRef node) {
|
||||
std::shared_ptr<YGNode> buildNodeFromJson(
|
||||
const json& j,
|
||||
std::shared_ptr<const YGConfig> config,
|
||||
std::shared_ptr<SerializedMeasureFuncMap> fns) {
|
||||
std::shared_ptr<MeasureFuncVecWithIndex> fns) {
|
||||
std::shared_ptr<YGNode> node(YGNodeNewWithConfig(config.get()), YGNodeFree);
|
||||
|
||||
if (!j.contains("node") || j["node"].is_null()) {
|
||||
@@ -265,13 +268,8 @@ std::shared_ptr<YGNode> buildNodeFromJson(
|
||||
for (json::iterator it = nodeState.begin(); it != nodeState.end(); it++) {
|
||||
if (it.key() == "always-forms-containing-block") {
|
||||
YGNodeSetAlwaysFormsContainingBlock(node.get(), it.value());
|
||||
} else if (it.key() == "measure-funcs") {
|
||||
std::vector<SerializedMeasureFunc> vec{};
|
||||
for (auto measureFuncJson : it.value()) {
|
||||
vec.push_back(serializedMeasureFuncFromJson(measureFuncJson));
|
||||
}
|
||||
fns->insert(std::make_pair(node.get(), vec));
|
||||
YGNodeSetContext(node.get(), it.value().is_null() ? nullptr : fns.get());
|
||||
} else if (it.key() == "has-custom-measure" && it.value()) {
|
||||
YGNodeSetContext(node.get(), fns.get());
|
||||
YGNodeSetMeasureFunc(node.get(), mockMeasureFunc);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +279,7 @@ std::shared_ptr<YGNode> buildNodeFromJson(
|
||||
|
||||
std::shared_ptr<YogaNodeAndConfig> buildTreeFromJson(
|
||||
const json& j,
|
||||
std::shared_ptr<SerializedMeasureFuncMap> fns,
|
||||
std::shared_ptr<MeasureFuncVecWithIndex> fns,
|
||||
std::shared_ptr<YogaNodeAndConfig> parent,
|
||||
size_t index) {
|
||||
auto config = buildConfigFromJson(j);
|
||||
@@ -299,7 +297,7 @@ std::shared_ptr<YogaNodeAndConfig> buildTreeFromJson(
|
||||
if (j.contains("children")) {
|
||||
json children = j["children"];
|
||||
size_t childIndex = 0;
|
||||
for (const json& child : children) {
|
||||
for (json child : children) {
|
||||
buildTreeFromJson(child, fns, wrapper, childIndex);
|
||||
childIndex++;
|
||||
}
|
||||
@@ -309,7 +307,8 @@ std::shared_ptr<YogaNodeAndConfig> buildTreeFromJson(
|
||||
}
|
||||
|
||||
BenchmarkResult generateBenchmark(json& capture) {
|
||||
auto fns = std::make_shared<SerializedMeasureFuncMap>();
|
||||
auto fns = std::make_shared<MeasureFuncVecWithIndex>();
|
||||
populateMeasureFuncVec(capture["measure-funcs"], fns);
|
||||
|
||||
auto treeCreationBegin = steady_clock::now();
|
||||
std::shared_ptr<YogaNodeAndConfig> root =
|
||||
@@ -331,25 +330,25 @@ BenchmarkResult generateBenchmark(json& capture) {
|
||||
}
|
||||
|
||||
static void printBenchmarkResult(
|
||||
const std::string& name,
|
||||
std::string name,
|
||||
SteadyClockDurations& durations) {
|
||||
std::array<double, kNumRepetitions> timesInMs{};
|
||||
std::array<double, kNumRepititions> timesInMs;
|
||||
double mean = 0;
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
auto ms = duration<double, std::milli>(durations[i]).count();
|
||||
timesInMs[i] = ms;
|
||||
mean += ms;
|
||||
}
|
||||
mean /= kNumRepetitions;
|
||||
mean /= kNumRepititions;
|
||||
|
||||
std::sort(timesInMs.begin(), timesInMs.end());
|
||||
double median = timesInMs[kNumRepetitions / 2];
|
||||
double median = timesInMs[kNumRepititions / 2];
|
||||
|
||||
double variance = 0;
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
variance += std::pow(timesInMs[i] - mean, 2);
|
||||
}
|
||||
variance /= kNumRepetitions;
|
||||
variance /= kNumRepititions;
|
||||
double stddev = std::sqrt(variance);
|
||||
|
||||
printf("%s: median: %lf ms, stddev: %lf ms\n", name.c_str(), median, stddev);
|
||||
@@ -370,7 +369,7 @@ void benchmark(std::filesystem::path& capturesDir) {
|
||||
std::string captureName = capture.path().stem().string();
|
||||
|
||||
std::cout << "Starting benchmark for " << captureName << std::endl;
|
||||
for (uint32_t i = 0; i < kNumRepetitions; i++) {
|
||||
for (uint32_t i = 0; i < kNumRepititions; i++) {
|
||||
BenchmarkResult result = generateBenchmark(j);
|
||||
treeCreationDurations[i] = result.treeCreationDuration;
|
||||
layoutDurations[i] = result.layoutDuration;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <yoga/Yoga.h>
|
||||
@@ -22,9 +21,7 @@ struct YogaNodeAndConfig {
|
||||
std::shared_ptr<YGNode> node,
|
||||
std::shared_ptr<const YGConfig> config,
|
||||
std::vector<std::shared_ptr<YogaNodeAndConfig>> children)
|
||||
: node_(std::move(node)),
|
||||
config_(std::move(config)),
|
||||
children_(std::move(children)) {}
|
||||
: node_(node), config_(config), children_(children) {}
|
||||
|
||||
std::shared_ptr<YGNode> node_;
|
||||
std::shared_ptr<const YGConfig> config_;
|
||||
|
@@ -21,13 +21,9 @@ static inline bool isAuto(json& j) {
|
||||
return j.is_string() && j == "auto";
|
||||
}
|
||||
|
||||
static inline bool isUndefined(json& j) {
|
||||
return j.is_string() && j == "undefined";
|
||||
}
|
||||
|
||||
static inline std::string invalidArgumentMessage(
|
||||
const std::string& arg,
|
||||
const std::string& enumName) {
|
||||
std::string arg,
|
||||
std::string enumName) {
|
||||
return arg + " does not represent any " + enumName + " values";
|
||||
}
|
||||
|
||||
@@ -40,7 +36,7 @@ static inline float floatFromJson(json& j) {
|
||||
return result;
|
||||
}
|
||||
|
||||
YGFlexDirection flexDirectionFromString(const std::string& str) {
|
||||
YGFlexDirection flexDirectionFromString(std::string str) {
|
||||
if (str == "row") {
|
||||
return YGFlexDirectionRow;
|
||||
} else if (str == "row-reverse") {
|
||||
@@ -54,7 +50,7 @@ YGFlexDirection flexDirectionFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGJustify justifyContentFromString(const std::string& str) {
|
||||
YGJustify justifyContentFromString(std::string str) {
|
||||
if (str == "flex-start") {
|
||||
return YGJustifyFlexStart;
|
||||
} else if (str == "center") {
|
||||
@@ -72,7 +68,7 @@ YGJustify justifyContentFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGAlign alignFromString(const std::string& str) {
|
||||
YGAlign alignFromString(std::string str) {
|
||||
if (str == "auto") {
|
||||
return YGAlignAuto;
|
||||
} else if (str == "flex-start") {
|
||||
@@ -96,7 +92,7 @@ YGAlign alignFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGWrap wrapFromString(const std::string& str) {
|
||||
YGWrap wrapFromString(std::string str) {
|
||||
if (str == "no-wrap") {
|
||||
return YGWrapNoWrap;
|
||||
} else if (str == "wrap") {
|
||||
@@ -108,7 +104,7 @@ YGWrap wrapFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGOverflow overflowFromString(const std::string& str) {
|
||||
YGOverflow overflowFromString(std::string str) {
|
||||
if (str == "visible") {
|
||||
return YGOverflowVisible;
|
||||
} else if (str == "hidden") {
|
||||
@@ -120,7 +116,7 @@ YGOverflow overflowFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGDisplay displayFromString(const std::string& str) {
|
||||
YGDisplay displayFromString(std::string str) {
|
||||
if (str == "flex") {
|
||||
return YGDisplayFlex;
|
||||
} else if (str == "none") {
|
||||
@@ -130,7 +126,7 @@ YGDisplay displayFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGPositionType positionTypeFromString(const std::string& str) {
|
||||
YGPositionType positionTypeFromString(std::string str) {
|
||||
if (str == "static") {
|
||||
return YGPositionTypeStatic;
|
||||
} else if (str == "relative") {
|
||||
@@ -146,9 +142,6 @@ YGUnit unitFromJson(json& j) {
|
||||
if (isAuto(j)) {
|
||||
return YGUnitAuto;
|
||||
}
|
||||
if (isUndefined(j)) {
|
||||
return YGUnitUndefined;
|
||||
}
|
||||
|
||||
std::string unit = j["unit"];
|
||||
if (unit == "px") {
|
||||
@@ -160,7 +153,7 @@ YGUnit unitFromJson(json& j) {
|
||||
}
|
||||
}
|
||||
|
||||
YGEdge edgeFromString(const std::string& str) {
|
||||
YGEdge edgeFromString(std::string str) {
|
||||
if (str == "left") {
|
||||
return YGEdgeLeft;
|
||||
} else if (str == "top") {
|
||||
@@ -184,7 +177,7 @@ YGEdge edgeFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGErrata errataFromString(const std::string& str) {
|
||||
YGErrata errataFromString(std::string str) {
|
||||
if (str == "none") {
|
||||
return YGErrataNone;
|
||||
} else if (str == "all") {
|
||||
@@ -196,7 +189,7 @@ YGErrata errataFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGExperimentalFeature experimentalFeatureFromString(const std::string& str) {
|
||||
YGExperimentalFeature experimentalFeatureFromString(std::string str) {
|
||||
if (str == "web-flex-basis") {
|
||||
return YGExperimentalFeatureWebFlexBasis;
|
||||
} else {
|
||||
@@ -206,12 +199,12 @@ YGExperimentalFeature experimentalFeatureFromString(const std::string& str) {
|
||||
}
|
||||
|
||||
std::string edgeStringFromPropertyName(
|
||||
const json::iterator& it,
|
||||
const std::string& propertyName) {
|
||||
json::iterator it,
|
||||
std::string propertyName) {
|
||||
return it.key().substr(propertyName.length() + 1);
|
||||
}
|
||||
|
||||
YGDirection directionFromString(const std::string& str) {
|
||||
YGDirection directionFromString(std::string str) {
|
||||
if (str == "ltr") {
|
||||
return YGDirectionLTR;
|
||||
} else if (str == "rtl") {
|
||||
@@ -223,7 +216,7 @@ YGDirection directionFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
YGMeasureMode measureModeFromString(const std::string& str) {
|
||||
YGMeasureMode measureModeFromString(std::string str) {
|
||||
if (str == "at-most") {
|
||||
return YGMeasureModeAtMost;
|
||||
} else if (str == "exactly") {
|
||||
@@ -235,14 +228,18 @@ YGMeasureMode measureModeFromString(const std::string& str) {
|
||||
}
|
||||
}
|
||||
|
||||
SerializedMeasureFunc serializedMeasureFuncFromJson(json& j) {
|
||||
return SerializedMeasureFunc{
|
||||
floatFromJson(j["width"]),
|
||||
measureModeFromString(j["width-mode"]),
|
||||
floatFromJson(j["height"]),
|
||||
measureModeFromString(j["height-mode"]),
|
||||
floatFromJson(j["output-width"]),
|
||||
floatFromJson(j["output-height"]),
|
||||
j["duration-ns"]};
|
||||
void populateMeasureFuncVec(
|
||||
json& j,
|
||||
std::shared_ptr<MeasureFuncVecWithIndex> fns) {
|
||||
for (auto measureFuncJson : j) {
|
||||
fns->vec.push_back(SerializedMeasureFunc{
|
||||
floatFromJson(measureFuncJson["width"]),
|
||||
measureModeFromString(measureFuncJson["width-mode"]),
|
||||
floatFromJson(measureFuncJson["height"]),
|
||||
measureModeFromString(measureFuncJson["height-mode"]),
|
||||
floatFromJson(measureFuncJson["output-width"]),
|
||||
floatFromJson(measureFuncJson["output-height"]),
|
||||
measureFuncJson["duration-ns"]});
|
||||
}
|
||||
}
|
||||
} // namespace facebook::yoga
|
||||
|
@@ -18,35 +18,42 @@ namespace facebook::yoga {
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
YGFlexDirection flexDirectionFromString(const std::string& str);
|
||||
struct MeasureFuncVecWithIndex {
|
||||
std::vector<SerializedMeasureFunc> vec;
|
||||
size_t index;
|
||||
};
|
||||
|
||||
YGJustify justifyContentFromString(const std::string& str);
|
||||
YGFlexDirection flexDirectionFromString(std::string str);
|
||||
|
||||
YGAlign alignFromString(const std::string& str);
|
||||
YGJustify justifyContentFromString(std::string str);
|
||||
|
||||
YGWrap wrapFromString(const std::string& str);
|
||||
YGAlign alignFromString(std::string str);
|
||||
|
||||
YGOverflow overflowFromString(const std::string& str);
|
||||
YGWrap wrapFromString(std::string str);
|
||||
|
||||
YGDisplay displayFromString(const std::string& str);
|
||||
YGOverflow overflowFromString(std::string str);
|
||||
|
||||
YGPositionType positionTypeFromString(const std::string& str);
|
||||
YGDisplay displayFromString(std::string str);
|
||||
|
||||
YGPositionType positionTypeFromString(std::string str);
|
||||
|
||||
YGUnit unitFromJson(json& j);
|
||||
|
||||
YGEdge edgeFromString(const std::string& str);
|
||||
YGEdge edgeFromString(std::string str);
|
||||
|
||||
YGErrata errataFromString(const std::string& str);
|
||||
YGErrata errataFromString(std::string str);
|
||||
|
||||
YGExperimentalFeature experimentalFeatureFromString(const std::string& str);
|
||||
YGExperimentalFeature experimentalFeatureFromString(std::string str);
|
||||
|
||||
std::string edgeStringFromPropertyName(
|
||||
const json::iterator& it,
|
||||
const std::string& propertyName);
|
||||
json::iterator it,
|
||||
std::string propertyName);
|
||||
|
||||
YGDirection directionFromString(const std::string& str);
|
||||
YGDirection directionFromString(std::string str);
|
||||
|
||||
YGMeasureMode measureModeFromString(const std::string& str);
|
||||
YGMeasureMode measureModeFromString(std::string str);
|
||||
|
||||
SerializedMeasureFunc serializedMeasureFuncFromJson(json& j);
|
||||
void populateMeasureFuncVec(
|
||||
json& j,
|
||||
std::shared_ptr<MeasureFuncVecWithIndex> fns);
|
||||
} // namespace facebook::yoga
|
||||
|
@@ -7,7 +7,7 @@ cd "$(dirname "$0")" || exit
|
||||
CAPTURES_PATH="$(dirname "$(realpath "$0")")""/captures"
|
||||
|
||||
if [ "$1" = "buck" ]; then
|
||||
buck run @//fbcode/mode/opt :benchmarkCXX "${CAPTURES_PATH}"
|
||||
buck run @fbcode/mode/opt :benchmarkCXX "${CAPTURES_PATH}"
|
||||
else
|
||||
cmake -B build -S . -D CMAKE_BUILD_TYPE=Release
|
||||
cmake --build build
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,224 @@
|
||||
"available-width": 1080.0,
|
||||
"owner-direction": "ltr"
|
||||
},
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 23667,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 330.0,
|
||||
"output-width": 408.0,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 9083,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 448.0,
|
||||
"output-width": 562.5,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7667,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 100.0,
|
||||
"output-width": 294.0,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 8333,
|
||||
"height": 676.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 94.0,
|
||||
"output-width": 328.6666564941406,
|
||||
"width": 328.6666564941406,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7791,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 8041,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 8000,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7709,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7666,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 6916,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7167,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 9333,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7125,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7125,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7209,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7083,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7333,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7375,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 8917,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7667,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
},
|
||||
{
|
||||
"duration-ns": 8583,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 295.0,
|
||||
"output-width": 816.0,
|
||||
"width": null,
|
||||
"width-mode": "undefined"
|
||||
},
|
||||
{
|
||||
"duration-ns": 7667,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 7.0,
|
||||
"output-width": 70.5,
|
||||
"width": 1076.0,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 494291,
|
||||
"height": 44.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 18.0,
|
||||
"output-width": 5.0,
|
||||
"width": 1016.0,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 58250,
|
||||
"height": 44.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 18.0,
|
||||
"output-width": 10.0,
|
||||
"width": 10.0,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
],
|
||||
"tree": {
|
||||
"children": [
|
||||
{
|
||||
@@ -19,17 +237,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8167,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 295.0,
|
||||
"output-width": 816.0,
|
||||
"width": null,
|
||||
"width-mode": "undefined"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -512,17 +720,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 24625,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 330.0,
|
||||
"output-width": 408.0,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -549,17 +747,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 9625,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 448.0,
|
||||
"output-width": 562.5,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -586,17 +774,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8417,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 100.0,
|
||||
"output-width": 294.0,
|
||||
"width": 647.3333129882813,
|
||||
"width-mode": "at-most"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -637,17 +815,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 9166,
|
||||
"height": 676.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 94.0,
|
||||
"output-width": 328.6666564941406,
|
||||
"width": 328.6666564941406,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"padding-all": {
|
||||
@@ -669,17 +837,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8250,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -722,17 +880,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8625,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -775,17 +923,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 7250,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -828,17 +966,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6833,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -881,17 +1009,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 7042,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -934,17 +1052,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6208,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -987,17 +1095,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6834,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1040,17 +1138,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8500,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1093,17 +1181,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6750,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1146,17 +1224,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6667,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1199,17 +1267,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8958,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1252,17 +1310,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 8125,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1305,17 +1353,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6541,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1358,17 +1396,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6541,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1411,17 +1439,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 6333,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1464,17 +1482,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 7875,
|
||||
"height": 566.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 21.0,
|
||||
"output-width": 158.33331298828125,
|
||||
"width": 158.33331298828125,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"margin-all": {
|
||||
@@ -1611,17 +1619,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 7583,
|
||||
"height": null,
|
||||
"height-mode": "undefined",
|
||||
"output-height": 7.0,
|
||||
"output-width": 70.5,
|
||||
"width": 1076.0,
|
||||
"width-mode": "at-most"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": null
|
||||
}
|
||||
@@ -1666,26 +1664,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": [
|
||||
{
|
||||
"duration-ns": 478791,
|
||||
"height": 44.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 18.0,
|
||||
"output-width": 5.0,
|
||||
"width": 1016.0,
|
||||
"width-mode": "at-most"
|
||||
},
|
||||
{
|
||||
"duration-ns": 61250,
|
||||
"height": 44.0,
|
||||
"height-mode": "at-most",
|
||||
"output-height": 18.0,
|
||||
"output-width": 10.0,
|
||||
"width": 10.0,
|
||||
"width-mode": "exactly"
|
||||
}
|
||||
]
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": null
|
||||
}
|
||||
@@ -1730,7 +1709,7 @@
|
||||
"errata": "all"
|
||||
},
|
||||
"node": {
|
||||
"measure-funcs": null
|
||||
"has-custom-measure": true
|
||||
},
|
||||
"style": {
|
||||
"flex": 1.0
|
||||
|
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("com.android.library") version "8.7.1" apply false
|
||||
id("com.android.application") version "8.7.1" apply false
|
||||
id("com.android.library") version "8.2.1" apply false
|
||||
id("com.android.application") version "8.2.1" apply false
|
||||
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <capture/CaptureTree.h>
|
||||
#include <capture/NodeToString.h>
|
||||
@@ -23,9 +23,10 @@ static void captureTree(
|
||||
file << serializedTree;
|
||||
}
|
||||
|
||||
static SerializedMeasureFuncMap& currentSerializedMeasureFuncMap() {
|
||||
static thread_local SerializedMeasureFuncMap map{};
|
||||
return map;
|
||||
static std::vector<SerializedMeasureFunc>& currentSerializedMeasureFuncVec() {
|
||||
static thread_local std::vector<SerializedMeasureFunc>
|
||||
currentSerializedMeasureFuncVec;
|
||||
return currentSerializedMeasureFuncVec;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -56,39 +57,32 @@ void YGNodeCalculateLayoutWithCapture(
|
||||
YGDirection ownerDirection,
|
||||
const std::filesystem::path& path) {
|
||||
dirtyTree(node);
|
||||
YGNodeCalculateLayout(node, availableWidth, availableHeight, ownerDirection);
|
||||
|
||||
json j;
|
||||
serializeLayoutInputs(j, availableWidth, availableHeight, ownerDirection);
|
||||
serializeTree(
|
||||
j,
|
||||
currentSerializedMeasureFuncMap(),
|
||||
node,
|
||||
PrintOptions::Style | PrintOptions::Children | PrintOptions::Config |
|
||||
PrintOptions::Node);
|
||||
|
||||
YGNodeCalculateLayout(node, availableWidth, availableHeight, ownerDirection);
|
||||
|
||||
serializeMeasureFuncResults(j, currentSerializedMeasureFuncVec());
|
||||
// TODO: It is possible to have a measure function call layout again if, e.g.,
|
||||
// views are nested in text. Need to be able to resolve this special case.
|
||||
currentSerializedMeasureFuncMap().clear();
|
||||
currentSerializedMeasureFuncVec().clear();
|
||||
captureTree(j.dump(2), path);
|
||||
}
|
||||
|
||||
void captureMeasureFunc(
|
||||
YGNodeConstRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGMeasureMode heightMode,
|
||||
YGSize output,
|
||||
std::chrono::steady_clock::duration durationNs) {
|
||||
auto measureFuncIt = currentSerializedMeasureFuncMap().find(node);
|
||||
if (measureFuncIt == currentSerializedMeasureFuncMap().end()) {
|
||||
std::vector<SerializedMeasureFunc> vec{};
|
||||
currentSerializedMeasureFuncMap().insert(std::make_pair(node, vec));
|
||||
}
|
||||
measureFuncIt = currentSerializedMeasureFuncMap().find(node);
|
||||
assert(measureFuncIt != currentSerializedMeasureFuncMap().end());
|
||||
measureFuncIt->second.push_back(
|
||||
{width,
|
||||
currentSerializedMeasureFuncVec().push_back(SerializedMeasureFunc{
|
||||
width,
|
||||
widthMode,
|
||||
height,
|
||||
heightMode,
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
@@ -22,12 +20,9 @@ struct SerializedMeasureFunc {
|
||||
YGMeasureMode heightMode{YGMeasureModeUndefined};
|
||||
float outputWidth{0.0f};
|
||||
float outputHeight{0.0f};
|
||||
std::chrono::steady_clock::duration::rep durationNs{};
|
||||
std::chrono::steady_clock::duration::rep durationNs;
|
||||
};
|
||||
|
||||
using SerializedMeasureFuncMap =
|
||||
std::unordered_map<YGNodeConstRef, std::vector<SerializedMeasureFunc>>;
|
||||
|
||||
void YGNodeCalculateLayoutWithCapture(
|
||||
YGNodeRef node,
|
||||
float availableWidth,
|
||||
@@ -36,7 +31,6 @@ void YGNodeCalculateLayoutWithCapture(
|
||||
const std::filesystem::path& path);
|
||||
|
||||
void captureMeasureFunc(
|
||||
YGNodeConstRef node,
|
||||
float width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
|
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <capture/NodeToString.h>
|
||||
|
||||
@@ -121,26 +120,7 @@ static YGValue borderFloatToYGValue(YGNodeRef node, YGEdge edge) {
|
||||
return YGValue{val, unit};
|
||||
}
|
||||
|
||||
static void serializeMeasureFuncResults(
|
||||
json& j,
|
||||
std::vector<SerializedMeasureFunc>& measureFuncs) {
|
||||
for (auto measureFunc : measureFuncs) {
|
||||
j["measure-funcs"].push_back(
|
||||
{{"width", measureFunc.inputWidth},
|
||||
{"width-mode", YGMeasureModeToString(measureFunc.widthMode)},
|
||||
{"height", measureFunc.inputHeight},
|
||||
{"height-mode", YGMeasureModeToString(measureFunc.heightMode)},
|
||||
{"output-width", measureFunc.outputWidth},
|
||||
{"output-height", measureFunc.outputHeight},
|
||||
{"duration-ns", measureFunc.durationNs}});
|
||||
}
|
||||
}
|
||||
|
||||
static void serializeTreeImpl(
|
||||
json& j,
|
||||
SerializedMeasureFuncMap& nodesToMeasureFuncs,
|
||||
YGNodeRef node,
|
||||
PrintOptions options) {
|
||||
static void serializeTreeImpl(json& j, YGNodeRef node, PrintOptions options) {
|
||||
if ((options & PrintOptions::Layout) == PrintOptions::Layout) {
|
||||
j["layout"]["width"] = YGNodeStyleGetWidth(node).value;
|
||||
j["layout"]["height"] = YGNodeStyleGetHeight(node).value;
|
||||
@@ -313,12 +293,7 @@ static void serializeTreeImpl(
|
||||
YGNodeGetAlwaysFormsContainingBlock(node),
|
||||
YGNodeGetAlwaysFormsContainingBlock(defaultNode.get()));
|
||||
if (YGNodeHasMeasureFunc(node)) {
|
||||
auto measureFuncIt = nodesToMeasureFuncs.find(node);
|
||||
if (measureFuncIt == nodesToMeasureFuncs.end()) {
|
||||
j["node"]["measure-funcs"];
|
||||
} else {
|
||||
serializeMeasureFuncResults(j["node"], measureFuncIt->second);
|
||||
}
|
||||
j["node"]["has-custom-measure"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,21 +302,13 @@ static void serializeTreeImpl(
|
||||
childCount > 0) {
|
||||
for (size_t i = 0; i < childCount; i++) {
|
||||
j["children"].push_back({});
|
||||
serializeTreeImpl(
|
||||
j["children"][i],
|
||||
nodesToMeasureFuncs,
|
||||
YGNodeGetChild(node, i),
|
||||
options);
|
||||
serializeTreeImpl(j["children"][i], YGNodeGetChild(node, i), options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void serializeTree(
|
||||
json& j,
|
||||
SerializedMeasureFuncMap& nodesToMeasureFuncs,
|
||||
YGNodeRef node,
|
||||
PrintOptions options) {
|
||||
serializeTreeImpl(j["tree"], nodesToMeasureFuncs, node, options);
|
||||
void serializeTree(json& j, YGNodeRef node, PrintOptions options) {
|
||||
serializeTreeImpl(j["tree"], node, options);
|
||||
}
|
||||
|
||||
void serializeLayoutInputs(
|
||||
@@ -356,4 +323,19 @@ void serializeLayoutInputs(
|
||||
};
|
||||
}
|
||||
|
||||
void serializeMeasureFuncResults(
|
||||
json& j,
|
||||
std::vector<SerializedMeasureFunc>& measureFuncs) {
|
||||
for (auto measureFunc : measureFuncs) {
|
||||
j["measure-funcs"].push_back(
|
||||
{{"width", measureFunc.inputWidth},
|
||||
{"width-mode", YGMeasureModeToString(measureFunc.widthMode)},
|
||||
{"height", measureFunc.inputHeight},
|
||||
{"height-mode", YGMeasureModeToString(measureFunc.heightMode)},
|
||||
{"output-width", measureFunc.outputWidth},
|
||||
{"output-height", measureFunc.outputHeight},
|
||||
{"duration-ns", measureFunc.durationNs}});
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace facebook::yoga
|
||||
|
@@ -25,11 +25,7 @@ enum class PrintOptions : uint8_t {
|
||||
};
|
||||
YG_DEFINE_ENUM_FLAG_OPERATORS(PrintOptions);
|
||||
|
||||
void serializeTree(
|
||||
nlohmann::json& j,
|
||||
SerializedMeasureFuncMap& nodesToMeasureFuncs,
|
||||
YGNodeRef node,
|
||||
PrintOptions options);
|
||||
void serializeTree(nlohmann::json& j, YGNodeRef root, PrintOptions options);
|
||||
|
||||
void serializeLayoutInputs(
|
||||
nlohmann::json& j,
|
||||
@@ -37,4 +33,8 @@ void serializeLayoutInputs(
|
||||
float availableHeight,
|
||||
YGDirection ownerDirection);
|
||||
|
||||
void serializeMeasureFuncResults(
|
||||
nlohmann::json& j,
|
||||
std::vector<SerializedMeasureFunc>& measureFuncs);
|
||||
|
||||
} // namespace facebook::yoga
|
||||
|
21
enums.py
21
enums.py
@@ -4,19 +4,12 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
import math
|
||||
import os
|
||||
|
||||
ENUMS = {
|
||||
"Direction": ["Inherit", "LTR", "RTL"],
|
||||
"Unit": [
|
||||
"Undefined",
|
||||
"Point",
|
||||
"Percent",
|
||||
"Auto",
|
||||
"MaxContent",
|
||||
"FitContent",
|
||||
"Stretch",
|
||||
],
|
||||
"Unit": ["Undefined", "Point", "Percent", "Auto"],
|
||||
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
||||
"Justify": [
|
||||
"FlexStart",
|
||||
@@ -39,9 +32,8 @@ ENUMS = {
|
||||
"SpaceEvenly",
|
||||
],
|
||||
"PositionType": ["Static", "Relative", "Absolute"],
|
||||
"Display": ["Flex", "None", "Contents"],
|
||||
"Display": ["Flex", "None"],
|
||||
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
||||
"BoxSizing": ["BorderBox", "ContentBox"],
|
||||
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
||||
"Dimension": ["Width", "Height"],
|
||||
"Edge": [
|
||||
@@ -69,10 +61,9 @@ ENUMS = {
|
||||
# Allows main-axis flex basis to be stretched without flexGrow being
|
||||
# set (previously referred to as "UseLegacyStretchBehaviour")
|
||||
("StretchFlexBasis", 1 << 0),
|
||||
# Absolute position in a given axis will be relative to the padding
|
||||
# edge of the parent container instead of the content edge when a
|
||||
# specific inset (top/bottom/left/right) is not set.
|
||||
("AbsolutePositionWithoutInsetsExcludesPadding", 1 << 1),
|
||||
# Positioning of absolute nodes will have various bugs related to
|
||||
# justification, alignment, and insets
|
||||
("AbsolutePositioningIncorrect", 1 << 1),
|
||||
# Absolute nodes will resolve percentages against the inner size of
|
||||
# their containing node, not the padding box
|
||||
("AbsolutePercentAgainstInnerSize", 1 << 2),
|
||||
|
@@ -2,18 +2,6 @@
|
||||
<div style="width:10px; height: 10px; position: absolute; start: 10px; top: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_auto_right" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: auto; right: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_right_auto" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: 10px; right: auto;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_left_auto_right_auto" style="width: 100px; height: 100px">
|
||||
<div style="width: 10px; height: 10px; position: absolute; left: auto; right: auto;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_width_height_end_bottom" style="width: 100px; height: 100px;">
|
||||
<div style="width:10px; height: 10px; position: absolute; end: 10px; bottom: 10px;"></div>
|
||||
</div>
|
||||
@@ -144,22 +132,6 @@
|
||||
<div style="position:absolute; width:50px; height:50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_padding">
|
||||
<div style="width:200px; height:200px; margin:10px; position: relative">
|
||||
<div style="position:static; width:200px; height:200px; padding: 50px;">
|
||||
<div style="position:absolute; width:50px; height:50px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_border">
|
||||
<div style="width:200px; height:200px; margin:10px; position: relative">
|
||||
<div style="position:static; width:200px; height:200px; border: 10px solid black;">
|
||||
<div style="position:absolute; width:50px; height:50px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="absolute_layout_column_reverse_margin_border"
|
||||
style="width:200px; height:200px; flex-direction: column-reverse;">
|
||||
<div
|
||||
|
@@ -155,14 +155,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_between_wrapped_negative_space_row_reverse" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-content: space-between; justify-content: center; height: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_between_wrapped_negative_space_gap" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row; flex-wrap: wrap; align-content: space-between; justify-content: center; height: 10px; gap: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
@@ -200,14 +192,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_around_wrapped_negative_space_row_reverse" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-content: space-around; justify-content: center; height: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_around_wrapped_negative_space_gap" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row; flex-wrap: wrap; align-content: space-around; justify-content: center; height: 10px; gap: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
@@ -448,32 +432,3 @@
|
||||
</div>
|
||||
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_flex_end_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-end;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-start;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="align_content_stretch_and_align_items_flex_start_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-start;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_center_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: center;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_stretch_and_align_items_stretch_with_flex_wrap"
|
||||
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: stretch;">
|
||||
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
|
||||
<div style="height: 100px; width: 120px;"></div>
|
||||
<div style="height: 50px; width: 120px;"></div>
|
||||
</div>
|
||||
|
@@ -13,7 +13,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="zero_aspect_ratio_behaves_like_auto" style="width: 300px; height: 300px;">
|
||||
<div style="aspect-ratio: 0; width: 50px"></div>
|
||||
</div>
|
||||
|
@@ -1,25 +0,0 @@
|
||||
<div id="auto_width" style="width: auto; height: 50px; flex-direction: row;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_height" style="width: 50px; height: auto;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_flex_basis" style="width: 50px; flex-basis: auto;">
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
<div style="width: 50px; height: 50px"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_position" style="width: 50px; height: 50px;">
|
||||
<div style="width: 25px; height: 25px; right: auto"></div>
|
||||
</div>
|
||||
|
||||
<div id="auto_margin" style="width: 50px; height: 50px;">
|
||||
<div style="width: 25px; height: 25px; margin-left: auto"></div>
|
||||
</div>
|
@@ -1,252 +0,0 @@
|
||||
<div id="box_sizing_content_box_simple"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_simple"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: content-box; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: border-box; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_comtaining_block"
|
||||
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: content-box; ">
|
||||
<div style="width: 75; height: 75; position: static;">
|
||||
<div style="width: 50px; height: 25%; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_comtaining_block"
|
||||
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: border-box; ">
|
||||
<div style="width: 75; height: 75; position: static;">
|
||||
<div style="width: 50px; height: 25%; position: absolute;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_only"
|
||||
style="width: 100px; height: 100px; padding: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_only_percent" style="width: 100px; height: 150px;">
|
||||
<div style="width: 50px; height: 75px; padding: 10%; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_only" style="width: 100px; height: 100px; padding: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_only_percent" style="width: 100px; height: 150px;">
|
||||
<div style="width: 50px; height: 75px; padding: 10%; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_only"
|
||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_only"
|
||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_children"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_children"
|
||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_siblings" style="width: 100px; height: 100px;">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px; box-sizing: content-box; padding: 10px; border-width: 10px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_siblings" style="width: 100px; height: 100px;">
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px; box-sizing: border-box; padding: 10px; border-width: 10px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_max_width" style="width: 100px; height: 100px;">
|
||||
<div style="max-width: 50px; height: 25px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_max_width" style="width: 100px; height: 100px;">
|
||||
<div style="max-width: 50px; height: 25px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_max_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; max-height: 50px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_max_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; max-height: 50px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_min_width" style="width: 100px; height: 100px;">
|
||||
<div style="min-width: 50px; height: 25px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_min_width" style="width: 100px; height: 100px;">
|
||||
<div style="min-width: 50px; height: 25px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_min_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; min-height: 50px; box-sizing: content-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_min_height" style="width: 100px; height: 100px;">
|
||||
<div style="width: 50px; min-height: 50px; box-sizing: border-box; padding: 5px; border-width: 15px"></div>
|
||||
<div style="width: 25px; height: 25px"></div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_no_height_no_width" style="width: 100px; height: 100px;">
|
||||
<div style="box-sizing: content-box; padding: 2px; border-width: 7px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_no_height_no_width" style="width: 100px; height: 100px;">
|
||||
<div style="box-sizing: border-box; padding: 2px; border-width: 7px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_nested"
|
||||
style="width: 100px; height: 100px; box-sizing: content-box; padding: 15px; border-width: 3px;">
|
||||
<div style="width: 20px; height: 20px; box-sizing: content-box; padding: 2px; border-width: 7px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: content-box; padding: 1px; border-width: 2px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_nested"
|
||||
style="width: 100px; height: 100px; box-sizing: border-box; padding: 15px; border-width: 3px;">
|
||||
<div style="width: 20px; height: 20px; box-sizing: border-box; padding: 2px; border-width: 7px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: border-box; padding: 1px; border-width: 2px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_nested_alternating"
|
||||
style="width: 100px; height: 100px; box-sizing: content-box; padding: 3px; border-width: 2px;">
|
||||
<div style="width: 40px; height: 40px; box-sizing: border-box; padding: 8px; border-width: 2px">
|
||||
<div style="width: 20px; height: 25px; box-sizing: content-box; padding: 3px; border-width: 6px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: border-box; padding: 1px; border-width: 1px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_nested_alternating"
|
||||
style="width: 100px; height: 100px; box-sizing: border-box; padding: 3px; border-width: 2px;">
|
||||
<div style="width: 40px; height: 40px; box-sizing: content-box; padding: 8px; border-width: 2px">
|
||||
<div style="width: 20px; height: 25px; box-sizing: border-box; padding: 3px; border-width: 6px">
|
||||
<div style="width: 10px; height: 5px; box-sizing: content-box; padding: 1px; border-width: 1px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="box_sizing_content_box_flex_basis_row"
|
||||
style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_flex_basis_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="box_sizing_content_box_flex_basis_column"
|
||||
style="width: 100px; height: 100px; flex-direction: column;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_flex_basis_column" style="width: 100px; height: 100px; flex-direction: column;">
|
||||
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_start"
|
||||
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_start"
|
||||
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_padding_end"
|
||||
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_padding_end"
|
||||
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_start"
|
||||
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_start"
|
||||
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: border-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_content_box_border_end"
|
||||
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: content-box">
|
||||
</div>
|
||||
|
||||
<div id="box_sizing_border_box_border_end"
|
||||
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: border-box">
|
||||
</div>
|
@@ -29,61 +29,3 @@
|
||||
<div id="display_none_with_position_absolute" style="width: 100px; height: 100px;">
|
||||
<div style="display:none; position: absolute; width: 100px; height: 100px"></div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_fixed_size" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; width: 50px; height: 50px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_margin" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="width: 20px; height: 20px; display: contents; margin: 10px;"></div>
|
||||
<div style="flex-grow: 1;"></div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_padding" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; padding: 10px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_position" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; top: 10px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_position_absolute" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents; position: absolute; width: 50px; height: 50px;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_nested" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="display: contents;">
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="display_contents_with_siblings" style="width: 100px; height: 100px; flex-direction: row;">
|
||||
<div style="flex: 1; height: 30px;"></div>
|
||||
<div style="display: contents;">
|
||||
<div style="flex: 1; height: 10px;"></div>
|
||||
<div style="flex: 1; height: 20px;"></div>
|
||||
</div>
|
||||
<div style="flex: 1; height: 30px;"></div>
|
||||
</div>
|
@@ -400,8 +400,3 @@
|
||||
<div style="width: 10px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="flex_direction_alternating_with_percent" style="height: 300px; width: 200px; flex-direction: column;">
|
||||
<div style="height: 50%; width: 50%; left: 10%; top: 10%; flex-direction: row;">
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -171,72 +171,3 @@
|
||||
<div style="height: 20px"></div>
|
||||
<div style="height: 30px"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping" style="flex-direction: row; width: 300px; height: 700px; padding: 10px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_determines_parent_height" style="flex-direction: row; width: 300px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_both_content_padding_and_item_padding" style="flex-direction: row; width: 300px; height: 700px; padding: 10px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px; padding: 10px;"></div>
|
||||
<div style="width: 100px; height: 100px; padding: 10px;"></div>
|
||||
<div style="width: 100px; height: 100px; padding: 10px;"></div>
|
||||
<div style="width: 100px; height: 100px; padding: 10px;"></div>
|
||||
<div style="width: 100px; height: 100px; padding: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_both_content_padding" style="flex-direction: row; width: 300px; height: 700px; padding: 10px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_content_margin" style="flex-direction: row; width: 300px; height: 700px; margin: 10px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_content_margin_and_padding" style="flex-direction: row; width: 300px; height: 700px; margin: 10px; padding: 10px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_flexible_content" style="flex-direction: row; width: 300px; height: 300px; gap: 10%;">
|
||||
<div style="flex: 1;"></div>
|
||||
<div style="flex: 1;"></div>
|
||||
<div style="flex: 1;"></div>
|
||||
</div>
|
||||
|
||||
<div id="row_gap_percent_wrapping_with_mixed_flexible_content" style="flex-direction: row; width: 300px; height: 300px; gap: 10%;">
|
||||
<div style="width: 10px;"></div>
|
||||
<div style="flex: 1;"></div>
|
||||
<div style="width: 10%;"></div>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Existing bug that Yoga is not inline with Chromium for calculation with min-width -->
|
||||
<div id="row_gap_percent_wrapping_with_min_width" data-disabled="true" style="flex-direction: row; min-width: 300px; gap: 10%; flex-wrap: wrap;">
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
<div style="width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
|
@@ -1,469 +0,0 @@
|
||||
<div id="contains_inner_text_long_word" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_no_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_no_height_long_word_in_paragraph"
|
||||
style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus
|
||||
loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumlorem
|
||||
Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width:100px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_no_width_fixed_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width_fixed_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width: 50px; height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_max_width_max_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-width: 50px; max-height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="contains_inner_text_max_width" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-width:100px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_width_shorter_text" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;width:100px">
|
||||
Lorem ipsum
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_fixed_height_shorter_text" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;height:100px">
|
||||
Lorem ipsum
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contains_inner_text_max_height" style="width:2000px;height:2000px;align-items: flex-start;">
|
||||
<div style="flex-direction:row;max-height:20px">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at
|
||||
volutpat
|
||||
libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus
|
||||
fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus
|
||||
vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor,
|
||||
vitae
|
||||
finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet
|
||||
consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo
|
||||
tincidunt
|
||||
finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam
|
||||
vulputate eleifasd lectus vel varius.
|
||||
Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis
|
||||
in
|
||||
faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel
|
||||
venenatis
|
||||
turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed
|
||||
nunc
|
||||
malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor
|
||||
lobortis.
|
||||
Sed at consectetur ipsum.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_width" style="flex-direction: row; width:max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_width" style="width: 90px; position: relative;">
|
||||
<div style="flex-direction: row; width: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_width" style="width: 500px; position: relative;">
|
||||
<div style="flex-direction: row; width: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_height" style="height:max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_height" style="height: 90px; position: relative;">
|
||||
<div style="height: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_height" style="height: 500px; position: relative;">
|
||||
<div style="height: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_flex_basis_column" style="flex-basis: max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_flex_basis_column" style="height: 90px; position: relative;">
|
||||
<div style="flex-basis: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_flex_basis_column" style="height: 500px; position: relative;">
|
||||
<div style="flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="max_content_flex_basis_row" style="flex-direction: row; flex-basis: max-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 500px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_flex_basis_row" style="width: 90px; position: relative;">
|
||||
<div style="flex-direction: row; flex-basis: fit-content; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_flex_basis_row" style="width: 500px; position: relative;">
|
||||
<div style="flex-direction: row; flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_max_width" style="flex-direction: row; max-width:max-content; width: 200px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_max_width" style="width: 90px; position: relative;">
|
||||
<div style="flex-direction: row; max-width: fit-content; width: 110px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_max_width" style="width: 500px; position: relative;">
|
||||
<div style="flex-direction: row; max-width: -webkit-fill-available; width: 600px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_min_width" style="flex-direction: row; min-width:max-content; width: 100px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_min_width" style="width: 90px; position: relative;">
|
||||
<div style="flex-direction: row; min-width: fit-content; width: 90px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_min_width" style="width: 500px; position: relative;">
|
||||
<div style="flex-direction: row; min-width: -webkit-fill-available; width: 400px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 100px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 25px; height: 50px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_max_height" style="max-height:max-content; height: 200px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_max_height" style="height: 90px; position: relative;">
|
||||
<div style="max-height: fit-content; height: 110px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_max_height" style="height: 500px; position: relative;">
|
||||
<div style="max-height: -webkit-fill-available; flex-wrap: wrap; height: 600px;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="max_content_min_height" style="min-height:max-content; height: 100px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="fit_content_min_height" style="height: 90px; position: relative;">
|
||||
<div style="min-height: fit-content; height: 90px; flex-wrap: wrap;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-disabled="true" id="stretch_min_height" style="height: 500px; position: relative;">
|
||||
<div style="min-height: -webkit-fill-available; flex-wrap: wrap; height: 400px;">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 100px;">
|
||||
</div>
|
||||
<div style="width: 50px; height: 25px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -70,7 +70,7 @@
|
||||
<div style="height: 20px; width: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_column_max_height_and_margin" style="height: 100px; max-height: 80px; margin-top: 100px; justify-content: center; flex-direction: column;">
|
||||
<div id="justify_content_colunn_max_height_and_margin" style="height: 100px; max-height: 80px; margin-top: 100px; justify-content: center; flex-direction: column;">
|
||||
<div style="height: 20px; width: 20px;"></div>
|
||||
</div>
|
||||
|
||||
@@ -120,59 +120,3 @@
|
||||
<div style="width: 20px;"></div>
|
||||
<div style="width: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_flex_start" style="width: 102px; height: 102px; flex-direction: row; justify-content: flex-start;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_flex_end" style="width: 102px; height: 102px; flex-direction: row; justify-content: flex-end;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_center" style="width: 102px; height: 102px; flex-direction: row; justify-content: center;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_space_between" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-between;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_space_around" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-around;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_space_evenly" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-evenly;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- TODO T208209388: fallback to start vs flexstart in overflowed cases -->
|
||||
<div data-disabled="true" id="justify_content_overflow_row_reverse_space_around" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-around;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<!-- TODO T208209388: fallback to start vs flexstart in overflowed cases -->
|
||||
<div data-disabled="true" id="justify_content_overflow_row_reverse_space_evenly" style="width: 102px; height: 102px; flex-direction: row-reverse; justify-content: space-evenly;">
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="justify_content_overflow_row_space_evenly_auto_margin" style="width: 102px; height: 102px; flex-direction: row; justify-content: space-evenly;">
|
||||
<div style="width: 40px; margin-right: auto;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
<div style="width: 40px;"></div>
|
||||
</div>
|
||||
|
@@ -60,13 +60,13 @@
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="margin_auto_multiple_children_column" style="width: 200px; height: 200px; flex-direction: column; align-items: center;">
|
||||
<div id="margin_auto_mutiple_children_column" style="width: 200px; height: 200px; flex-direction: column; align-items: center;">
|
||||
<div style="width: 50px; height: 50px; margin-top:auto;"></div>
|
||||
<div style="width: 50px; height: 50px; margin-top:auto;"></div>
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="margin_auto_multiple_children_row" style="width: 200px; height: 200px; flex-direction:row; align-items: center;">
|
||||
<div id="margin_auto_mutiple_children_row" style="width: 200px; height: 200px; flex-direction:row; align-items: center;">
|
||||
<div style="width: 50px; height: 50px; margin-right:auto;"></div>
|
||||
<div style="width: 50px; height: 50px; margin-right:auto;"></div>
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
@@ -150,8 +150,3 @@
|
||||
<div style="flex: 1; margin-left:auto;"></div>
|
||||
<div style="width: 50px; height: 50px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="margin_auto_overflowing_container" style="width: 200px; height: 200px; align-items: center;">
|
||||
<div style="width: 50px; height: 150px; margin-bottom: auto;"></div>
|
||||
<div style="width: 50px; height: 150px;"></div>
|
||||
</div>
|
||||
|
@@ -13,17 +13,10 @@
|
||||
<div style="height: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="padding_center_child"
|
||||
style="width: 100px; height: 100px; padding-start: 10px; padding-top: 10; padding-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
|
||||
<div id="padding_center_child" style="width: 100px; height: 100px; padding-start: 10px; padding-top: 10; padding-end: 20px; padding-bottom: 20px; align-items: center; justify-content: center;">
|
||||
<div style="height: 10px; width: 10px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="child_with_padding_align_end"
|
||||
style="width: 200px; height: 200px; justify-content: flex-end; align-items: flex-end;">
|
||||
<div id="child_with_padding_align_end" style="width: 200px; height: 200px; justify-content: flex-end; align-items: flex-end;">
|
||||
<div style="width: 100px; height: 100px; padding: 20px;"></div>
|
||||
</div>
|
||||
|
||||
<div id="physical_and_relative_edge_defined"
|
||||
style="width: 200px; height: 200px; padding-left: 20px; padding-end: 50px;">
|
||||
<div style="width: 100%; height: 50px;"></div>
|
||||
</div>
|
||||
|
@@ -693,20 +693,3 @@
|
||||
style="height: 50%; width: 50%; position: absolute; border-width: 3px 2px 1px 4px; padding: 7px 5px 4px 3px; margin: 11px 15px 1px 12px">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="static_position_absolute_child_multiple">
|
||||
<div style="width: 400px; height: 400px; padding: 100px; position: relative">
|
||||
<div style="height:100px; width: 100px; position: static">
|
||||
<div style="height: 50px; width: 10%; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height:100px; width: 100px; position: static">
|
||||
<div style="height: 50px; width: 50%; position: absolute">
|
||||
</div>
|
||||
<div style="height: 50px; width: 50%; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 50px; width: 25px; position: absolute">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Binary file not shown.
@@ -12,44 +12,15 @@ function toValueCpp(value) {
|
||||
return n + (Number(n) == n && n % 1 !== 0 ? 'f' : '');
|
||||
}
|
||||
|
||||
function toFunctionNameCpp(value) {
|
||||
function toFunctionName(value) {
|
||||
if (value.indexOf('%') >= 0) {
|
||||
return 'Percent';
|
||||
} else if (value.indexOf('Auto') >= 0) {
|
||||
return 'Auto';
|
||||
} else if (value.indexOf('MaxContent') >= 0) {
|
||||
return 'MaxContent';
|
||||
} else if (value.indexOf('FitContent') >= 0) {
|
||||
return 'FitContent';
|
||||
} else if (value.indexOf('Stretch') >= 0) {
|
||||
return 'Stretch';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function keywordFunctionCpp(functionPrefix, nodeName, value) {
|
||||
const functionSuffix = toFunctionNameCpp(value);
|
||||
if (
|
||||
functionSuffix == 'Auto' ||
|
||||
functionSuffix == 'MaxContent' ||
|
||||
functionSuffix == 'FitContent' ||
|
||||
functionSuffix == 'Stretch'
|
||||
) {
|
||||
return functionPrefix + functionSuffix + '(' + nodeName + ');';
|
||||
} else {
|
||||
return (
|
||||
functionPrefix +
|
||||
functionSuffix +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const CPPEmitter = function () {
|
||||
Emitter.call(this, 'cpp', ' ');
|
||||
};
|
||||
@@ -59,12 +30,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue: {
|
||||
value: function () {
|
||||
this.push([
|
||||
'#include <gtest/gtest.h>',
|
||||
'#include <yoga/Yoga.h>',
|
||||
'#include "../util/TestUtil.h"',
|
||||
'',
|
||||
]);
|
||||
this.push(['#include <gtest/gtest.h>', '#include <yoga/Yoga.h>', '']);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -78,7 +44,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
this.push('');
|
||||
}
|
||||
|
||||
this.push('YGConfigRef config = YGConfigNew();');
|
||||
this.push('const YGConfigRef config = YGConfigNew();');
|
||||
for (const i in experiments) {
|
||||
this.push(
|
||||
'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' +
|
||||
@@ -92,7 +58,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitTestTreePrologue: {
|
||||
value: function (nodeName) {
|
||||
this.push('YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);');
|
||||
this.push(
|
||||
'const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -165,20 +133,12 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
YGWrapWrap: {value: 'YGWrapWrap'},
|
||||
YGWrapWrapReverse: {value: 'YGWrapWrapReverse'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'YGBoxSizingBorderBox'},
|
||||
YGBoxSizingContentBox: {value: 'YGBoxSizingContentBox'},
|
||||
|
||||
YGUndefined: {value: 'YGUndefined'},
|
||||
|
||||
YGDisplayFlex: {value: 'YGDisplayFlex'},
|
||||
YGDisplayNone: {value: 'YGDisplayNone'},
|
||||
YGDisplayContents: {value: 'YGDisplayContents'},
|
||||
YGAuto: {value: 'YGAuto'},
|
||||
|
||||
YGMaxContent: {value: 'MaxContent'},
|
||||
YGFitContent: {value: 'FitContent'},
|
||||
YGStretch: {value: 'Stretch'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
this.push(
|
||||
@@ -265,7 +225,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetAspectRatio' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -307,7 +267,15 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetFlexBasis', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetFlexBasis' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -351,6 +319,20 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetJustifyContent: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
@@ -373,7 +355,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
}
|
||||
this.push(
|
||||
'YGNodeStyleSetMargin' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -384,39 +366,59 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMaxWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMinHeight' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value));
|
||||
this.push(
|
||||
'YGNodeStyleSetMinWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -432,7 +434,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetPadding' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -446,20 +448,15 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
let valueStr = toValueCpp(value);
|
||||
if (valueStr != 'YGAuto') {
|
||||
valueStr = ', ' + valueStr;
|
||||
} else {
|
||||
valueStr = '';
|
||||
}
|
||||
this.push(
|
||||
'YGNodeStyleSetPosition' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
edge +
|
||||
valueStr +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
@@ -477,11 +474,25 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetWidth' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetGap: {
|
||||
value: function (nodeName, gap, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetGap' +
|
||||
toFunctionNameCpp(value) +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
@@ -492,21 +503,4 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetBoxSizing(' + nodeName + ', ' + toValueCpp(value) + ');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText) {
|
||||
this.push(`YGNodeSetContext(${nodeName}, (void*)"${innerText}");`);
|
||||
this.push(
|
||||
`YGNodeSetMeasureFunc(${nodeName}, &facebook::yoga::test::IntrinsicSizeMeasure);`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -100,21 +100,15 @@ for (const fileName of fixtures) {
|
||||
await driver.get('file://' + process.cwd() + '/test.html');
|
||||
const logs = await driver.manage().logs().get(logging.Type.BROWSER);
|
||||
|
||||
const testLogs = logs.filter(
|
||||
log => !log.message.replace(/^[^"]*/, '').startsWith('"gentest-log:'),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/tests/generated/${fileNameNoExtension}.cpp`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[0].message.replace(/^[^"]*/, '')),
|
||||
),
|
||||
addSignatureToSourceCode(JSON.parse(logs[0].message.replace(/^[^"]*/, ''))),
|
||||
);
|
||||
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/java/tests/generated/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
`${yogaDir}/java/tests/com/facebook/yoga/${fileNameNoExtension}.java`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(logs[1].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
@@ -124,7 +118,7 @@ for (const fileName of fixtures) {
|
||||
await fs.writeFile(
|
||||
`${yogaDir}/javascript/tests/generated/${fileNameNoExtension}.test.ts`,
|
||||
addSignatureToSourceCode(
|
||||
JSON.parse(testLogs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
JSON.parse(logs[2].message.replace(/^[^"]*/, '')).replace(
|
||||
'YogaTest',
|
||||
fileNameNoExtension,
|
||||
),
|
||||
|
@@ -17,38 +17,10 @@ function toMethodName(value) {
|
||||
return 'Percent';
|
||||
} else if (value.indexOf('AUTO') >= 0) {
|
||||
return 'Auto';
|
||||
} else if (value.indexOf('MAX_CONTENT') >= 0) {
|
||||
return 'MaxContent';
|
||||
} else if (value.indexOf('FIT_CONTENT') >= 0) {
|
||||
return 'FitContent';
|
||||
} else if (value.indexOf('STRETCH') >= 0) {
|
||||
return 'Stretch';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function keywordMethod(methodPrefix, nodeName, value) {
|
||||
const methodSuffix = toMethodName(value);
|
||||
if (
|
||||
methodSuffix == 'Auto' ||
|
||||
methodSuffix == 'MaxContent' ||
|
||||
methodSuffix == 'FitContent' ||
|
||||
methodSuffix == 'Stretch'
|
||||
) {
|
||||
return nodeName + '.' + methodPrefix + methodSuffix + '();';
|
||||
} else {
|
||||
return (
|
||||
nodeName +
|
||||
'.' +
|
||||
methodPrefix +
|
||||
methodSuffix +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const JavaEmitter = function () {
|
||||
Emitter.call(this, 'java', ' ');
|
||||
};
|
||||
@@ -83,7 +55,6 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
'import org.junit.Test;',
|
||||
'import org.junit.runner.RunWith;',
|
||||
'import org.junit.runners.Parameterized;',
|
||||
'import com.facebook.yoga.utils.TestUtils;',
|
||||
'',
|
||||
'@RunWith(Parameterized.class)',
|
||||
'public class YogaTest {',
|
||||
@@ -206,20 +177,12 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGDisplayFlex: {value: 'YogaDisplay.FLEX'},
|
||||
YGDisplayNone: {value: 'YogaDisplay.NONE'},
|
||||
YGDisplayContents: {value: 'YogaDisplay.CONTENTS'},
|
||||
YGAuto: {value: 'YogaConstants.AUTO'},
|
||||
|
||||
YGWrapNoWrap: {value: 'YogaWrap.NO_WRAP'},
|
||||
YGWrapWrap: {value: 'YogaWrap.WRAP'},
|
||||
YGWrapWrapReverse: {value: 'YogaWrap.WRAP_REVERSE'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'YogaBoxSizing.BORDER_BOX'},
|
||||
YGBoxSizingContentBox: {value: 'YogaBoxSizing.CONTENT_BOX'},
|
||||
|
||||
YGMaxContent: {value: 'MAX_CONTENT'},
|
||||
YGFitContent: {value: 'FIT_CONTENT'},
|
||||
YGStretch: {value: 'STRETCH'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
this.push(node + '.setDirection(' + dir + ');');
|
||||
@@ -306,7 +269,14 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetFlexBasis: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setFlexBasis', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setFlexBasis' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -334,6 +304,19 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetJustifyContent: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setJustifyContent(' + toValueJava(value) + ');');
|
||||
@@ -361,39 +344,55 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setHeight', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setWidth', nodeName, value));
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMaxHeight', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMaxWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMaxWidth', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMaxWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinHeight: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMinHeight', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinHeight' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetMinWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(keywordMethod('setMinWidth', nodeName, value));
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setMinWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -420,21 +419,15 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
let valueStr = toValueJava(value);
|
||||
|
||||
if (valueStr == 'YogaConstants.AUTO') {
|
||||
valueStr = '';
|
||||
} else {
|
||||
valueStr = ', ' + valueStr + 'f';
|
||||
}
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
edge +
|
||||
valueStr +
|
||||
');',
|
||||
', ' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
@@ -445,6 +438,19 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetWidth: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setWidth' +
|
||||
toMethodName(value) +
|
||||
'(' +
|
||||
toValueJava(value) +
|
||||
'f);',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetGap: {
|
||||
value: function (nodeName, gap, value) {
|
||||
this.push(
|
||||
@@ -459,19 +465,4 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setBoxSizing(' + toValueJava(value) + ');');
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText) {
|
||||
this.push(`${nodeName}.setData("${innerText}");`);
|
||||
this.push(
|
||||
`${nodeName}.setMeasureFunction(new TestUtils.intrinsicMeasureFunction());`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -15,9 +15,6 @@ function toValueJavascript(value) {
|
||||
if (value.match(/^[0-9.e+-]+px$/i)) return parseFloat(value);
|
||||
if (value.match(/^[0-9.e+-]+%/i)) return JSON.stringify(value);
|
||||
if (value == 'Yoga.AUTO') return '"auto"';
|
||||
if (value == 'max-content') return '"max-content"';
|
||||
if (value == 'fit-content') return '"fit-content"';
|
||||
if (value == 'stretch') return '"stretch"';
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -26,14 +23,10 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
emitPrologue: {
|
||||
value: function () {
|
||||
this.push(
|
||||
"import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'",
|
||||
);
|
||||
this.push("import Yoga from 'yoga-layout';");
|
||||
this.push('import {');
|
||||
this.pushIndent();
|
||||
this.push('Align,');
|
||||
this.push('BoxSizing,');
|
||||
this.push('Direction,');
|
||||
this.push('Display,');
|
||||
this.push('Edge,');
|
||||
@@ -174,14 +167,6 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGDisplayFlex: {value: 'Display.Flex'},
|
||||
YGDisplayNone: {value: 'Display.None'},
|
||||
YGDisplayContents: {value: 'Display.Contents'},
|
||||
|
||||
YGBoxSizingBorderBox: {value: 'BoxSizing.BorderBox'},
|
||||
YGBoxSizingContentBox: {value: 'BoxSizing.ContentBox'},
|
||||
|
||||
YGMaxContent: {value: 'max-content'},
|
||||
YGFitContent: {value: 'fit-content'},
|
||||
YGStretch: {value: 'stretch'},
|
||||
|
||||
YGNodeCalculateLayout: {
|
||||
value: function (node, dir, _experiments) {
|
||||
@@ -376,22 +361,14 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
|
||||
YGNodeStyleSetPosition: {
|
||||
value: function (nodeName, edge, value) {
|
||||
const valueStr = toValueJavascript(value);
|
||||
|
||||
if (valueStr == "'auto'") {
|
||||
this.push(
|
||||
nodeName + '.setPositionAuto(' + toValueJavascript(edge) + ');',
|
||||
);
|
||||
} else {
|
||||
this.push(
|
||||
nodeName +
|
||||
'.setPosition(' +
|
||||
toValueJavascript(edge) +
|
||||
', ' +
|
||||
valueStr +
|
||||
toValueJavascript(value) +
|
||||
');',
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -421,18 +398,4 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBoxSizing: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setBoxSizing(' + toValueJavascript(value) + ');');
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeSetMeasureFunc: {
|
||||
value: function (nodeName, innerText) {
|
||||
this.push(
|
||||
`${nodeName}.setMeasureFunc(instrinsicSizeMeasureFunc.bind("${innerText}"));`,
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -11,33 +11,30 @@ import * as fs from 'node:fs/promises';
|
||||
import {dirname} from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import signedsource from 'signedsource';
|
||||
import {glob} from 'glob';
|
||||
|
||||
const yogaRootDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
const yogaDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
||||
const cppTestDir = `${yogaDir}/tests/generated`;
|
||||
const jsTestDir = `${yogaDir}/javascript/tests/generated`;
|
||||
const javaTestDir = `${yogaDir}/java/tests/com/facebook/yoga`;
|
||||
const testDirs = [cppTestDir, jsTestDir, javaTestDir];
|
||||
|
||||
const filesToValidate = await glob(
|
||||
[
|
||||
'tests/generated/**/*.{h,cpp}',
|
||||
'javascript/tests/generated/**/*.test.ts',
|
||||
'java/tests/generated/com/facebook/yoga/**/*.java',
|
||||
],
|
||||
{
|
||||
cwd: yogaRootDir,
|
||||
},
|
||||
);
|
||||
for (const testDir of testDirs) {
|
||||
const tests = await fs.readdir(testDir);
|
||||
|
||||
console.log(`Found ${filesToValidate.length} files to validate`);
|
||||
|
||||
for (const file of filesToValidate) {
|
||||
const content = await fs.readFile(`${yogaRootDir}/${file}`, 'utf8');
|
||||
if (signedsource.isSigned(content)) {
|
||||
console.log(`Checking ${file}`);
|
||||
const validSignature = signedsource.verifySignature(content);
|
||||
for (const test of tests) {
|
||||
const testData = await fs.readFile(`${testDir}/${test}`, 'utf8');
|
||||
try {
|
||||
const validSignature = signedsource.verifySignature(testData);
|
||||
if (!validSignature) {
|
||||
console.error(`Invalid signature "${file}"`);
|
||||
console.error(`Invalid signature for ${test}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
} else {
|
||||
console.log(`Skipped ${file}`);
|
||||
} catch (e) {
|
||||
// Java test dir does not separate generated tests from non-generated ones
|
||||
if (testDir != javaTestDir) {
|
||||
console.error(`${test}: ${e}`);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -175,7 +175,6 @@ function checkDefaultValues() {
|
||||
{style: 'right', value: 'undefined'},
|
||||
{style: 'bottom', value: 'undefined'},
|
||||
{style: 'display', value: 'flex'},
|
||||
{style: 'box-sizing', value: 'border-box'},
|
||||
].forEach(item => {
|
||||
assert(
|
||||
isDefaultStyleValue(item.style, item.value),
|
||||
@@ -194,6 +193,7 @@ function setupTestTree(
|
||||
index,
|
||||
) {
|
||||
e.emitTestTreePrologue(nodeName);
|
||||
|
||||
for (const style in node.style) {
|
||||
// Skip position info for root as it messes up tests
|
||||
if (
|
||||
@@ -207,6 +207,7 @@ function setupTestTree(
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isDefaultStyleValue(style, node.style[style])) {
|
||||
switch (style) {
|
||||
case 'aspect-ratio':
|
||||
@@ -519,11 +520,6 @@ function setupTestTree(
|
||||
case 'display':
|
||||
e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style]));
|
||||
break;
|
||||
case 'box-sizing':
|
||||
e.YGNodeStyleSetBoxSizing(
|
||||
nodeName,
|
||||
boxSizingValue(e, node.style[style]),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -532,10 +528,6 @@ function setupTestTree(
|
||||
e.YGNodeInsertChild(parentName, nodeName, index);
|
||||
}
|
||||
|
||||
if (node.innerText && node.children.length === 0) {
|
||||
e.YGNodeSetMeasureFunc(nodeName, node.innerText);
|
||||
}
|
||||
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
e.push('');
|
||||
const childName = nodeName + '_child' + i;
|
||||
@@ -654,13 +646,6 @@ function pointValue(e, value) {
|
||||
return e.YGAuto;
|
||||
case 'undefined':
|
||||
return e.YGUndefined;
|
||||
case 'max-content':
|
||||
return e.YGMaxContent;
|
||||
case 'fit-content':
|
||||
return e.YGFitContent;
|
||||
case 'stretch':
|
||||
case '-webkit-fill-available':
|
||||
return e.YGStretch;
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
@@ -672,17 +657,6 @@ function displayValue(e, value) {
|
||||
return e.YGDisplayFlex;
|
||||
case 'none':
|
||||
return e.YGDisplayNone;
|
||||
case 'contents':
|
||||
return e.YGDisplayContents;
|
||||
}
|
||||
}
|
||||
|
||||
function boxSizingValue(e, value) {
|
||||
switch (value) {
|
||||
case 'border-box':
|
||||
return e.YGBoxSizingBorderBox;
|
||||
case 'content-box':
|
||||
return e.YGBoxSizingContentBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,7 +723,6 @@ function calculateTree(root, parentOffsetLeft, parentOffsetTop) {
|
||||
? child.dataset.experiments.split(' ')
|
||||
: [],
|
||||
disabled: child.dataset.disabled === 'true',
|
||||
innerText: child.innerText,
|
||||
};
|
||||
|
||||
const size = getRoundedSize(child);
|
||||
@@ -804,7 +777,6 @@ function getYogaStyle(node) {
|
||||
'row-gap',
|
||||
'display',
|
||||
'aspect-ratio',
|
||||
'box-sizing',
|
||||
].reduce((map, key) => {
|
||||
map[key] =
|
||||
node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||
|
@@ -3,8 +3,8 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"gentest": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --disable-warning=ExperimentalWarning --loader=babel-register-esm ./gentest-validate.ts"
|
||||
"gentest": "node --loader=babel-register-esm ./gentest-driver.ts",
|
||||
"gentest-validate": "node --loader=babel-register-esm ./gentest-validate.ts"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
@@ -19,7 +19,6 @@
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "^20.10.3",
|
||||
"@types/selenium-webdriver": "^4.1.21",
|
||||
"babel-register-esm": "^1.2.5",
|
||||
"glob": "^10.4.2"
|
||||
"babel-register-esm": "^1.2.5"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>%s</title>
|
||||
@@ -8,23 +7,17 @@
|
||||
<script src="gentest-cpp.js"></script>
|
||||
<script src="gentest-java.js"></script>
|
||||
<script src="gentest-javascript.js"></script>
|
||||
<script src="gentest-log.js"></script>
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Ahem';
|
||||
src: url('./fonts/Ahem.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font: 10px/1 Ahem;
|
||||
font-family: Helvetica;
|
||||
font-size: 14px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
div,
|
||||
span {
|
||||
div, span {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
border: 0 solid black;
|
||||
@@ -51,7 +44,6 @@
|
||||
position: absolute;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -75,5 +67,4 @@
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=0.0.0
|
||||
VERSION_NAME=3.0.1
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@@ -21,9 +21,9 @@ val ndkVersionProperty: String by rootProject.extra
|
||||
|
||||
android {
|
||||
namespace = "com.facebook.yoga"
|
||||
compileSdk = 35
|
||||
buildToolsVersion = "35.0.0"
|
||||
ndkVersion = "27.1.12297006"
|
||||
compileSdk = 34
|
||||
buildToolsVersion = "34.0.0"
|
||||
ndkVersion = "26.0.10792818"
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 21
|
||||
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public enum YogaBoxSizing {
|
||||
BORDER_BOX(0),
|
||||
CONTENT_BOX(1);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaBoxSizing(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
public static YogaBoxSizing fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return BORDER_BOX;
|
||||
case 1: return CONTENT_BOX;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,8 +11,7 @@ package com.facebook.yoga;
|
||||
|
||||
public enum YogaDisplay {
|
||||
FLEX(0),
|
||||
NONE(1),
|
||||
CONTENTS(2);
|
||||
NONE(1);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -28,7 +27,6 @@ public enum YogaDisplay {
|
||||
switch (value) {
|
||||
case 0: return FLEX;
|
||||
case 1: return NONE;
|
||||
case 2: return CONTENTS;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ package com.facebook.yoga;
|
||||
public enum YogaErrata {
|
||||
NONE(0),
|
||||
STRETCH_FLEX_BASIS(1),
|
||||
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
|
||||
ABSOLUTE_POSITIONING_INCORRECT(2),
|
||||
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
|
||||
ALL(2147483647),
|
||||
CLASSIC(2147483646);
|
||||
@@ -31,7 +31,7 @@ public enum YogaErrata {
|
||||
switch (value) {
|
||||
case 0: return NONE;
|
||||
case 1: return STRETCH_FLEX_BASIS;
|
||||
case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING;
|
||||
case 2: return ABSOLUTE_POSITIONING_INCORRECT;
|
||||
case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE;
|
||||
case 2147483647: return ALL;
|
||||
case 2147483646: return CLASSIC;
|
||||
|
@@ -56,8 +56,6 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetAlignContentJNI(long nativePointer, int alignContent);
|
||||
static native int jni_YGNodeStyleGetPositionTypeJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetPositionTypeJNI(long nativePointer, int positionType);
|
||||
static native int jni_YGNodeStyleGetBoxSizingJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetBoxSizingJNI(long nativePointer, int boxSizing);
|
||||
static native int jni_YGNodeStyleGetFlexWrapJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexWrapJNI(long nativePointer, int wrapType);
|
||||
static native int jni_YGNodeStyleGetOverflowJNI(long nativePointer);
|
||||
@@ -74,9 +72,6 @@ public class YogaNative {
|
||||
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
||||
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
||||
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
||||
@@ -89,50 +84,30 @@ public class YogaNative {
|
||||
static native long jni_YGNodeStyleGetPositionJNI(long nativePointer, int edge);
|
||||
static native void jni_YGNodeStyleSetPositionJNI(long nativePointer, int edge, float position);
|
||||
static native void jni_YGNodeStyleSetPositionPercentJNI(long nativePointer, int edge, float percent);
|
||||
static native void jni_YGNodeStyleSetPositionAutoJNI(long nativePointer, int edge);
|
||||
static native long jni_YGNodeStyleGetWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
||||
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
||||
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
||||
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
||||
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
||||
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
|
||||
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
||||
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
||||
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
|
||||
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
||||
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
||||
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
||||
static native void jni_YGNodeStyleSetGapJNI(long nativePointer, int gutter, float gapLength);
|
||||
static native void jni_YGNodeStyleSetGapPercentJNI(long nativePointer, int gutter, float gapLength);
|
||||
static native void jni_YGNodeSetHasMeasureFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
||||
static native void jni_YGNodeSetHasBaselineFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
||||
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
|
||||
|
@@ -88,10 +88,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setPositionType(YogaPositionType positionType);
|
||||
|
||||
public abstract YogaBoxSizing getBoxSizing();
|
||||
|
||||
public abstract void setBoxSizing(YogaBoxSizing boxSizing);
|
||||
|
||||
public abstract YogaWrap getWrap();
|
||||
|
||||
public abstract void setWrap(YogaWrap flexWrap);
|
||||
@@ -124,12 +120,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setFlexBasisAuto();
|
||||
|
||||
public abstract void setFlexBasisMaxContent();
|
||||
|
||||
public abstract void setFlexBasisFitContent();
|
||||
|
||||
public abstract void setFlexBasisStretch();
|
||||
|
||||
public abstract YogaValue getMargin(YogaEdge edge);
|
||||
|
||||
public abstract void setMargin(YogaEdge edge, float margin);
|
||||
@@ -154,8 +144,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setPositionPercent(YogaEdge edge, float percent);
|
||||
|
||||
public abstract void setPositionAuto(YogaEdge edge);
|
||||
|
||||
public abstract YogaValue getWidth();
|
||||
|
||||
public abstract void setWidth(float width);
|
||||
@@ -164,12 +152,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setWidthAuto();
|
||||
|
||||
public abstract void setWidthMaxContent();
|
||||
|
||||
public abstract void setWidthFitContent();
|
||||
|
||||
public abstract void setWidthStretch();
|
||||
|
||||
public abstract YogaValue getHeight();
|
||||
|
||||
public abstract void setHeight(float height);
|
||||
@@ -178,60 +160,30 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setHeightAuto();
|
||||
|
||||
public abstract void setHeightMaxContent();
|
||||
|
||||
public abstract void setHeightFitContent();
|
||||
|
||||
public abstract void setHeightStretch();
|
||||
|
||||
public abstract YogaValue getMinWidth();
|
||||
|
||||
public abstract void setMinWidth(float minWidth);
|
||||
|
||||
public abstract void setMinWidthPercent(float percent);
|
||||
|
||||
public abstract void setMinWidthMaxContent();
|
||||
|
||||
public abstract void setMinWidthFitContent();
|
||||
|
||||
public abstract void setMinWidthStretch();
|
||||
|
||||
public abstract YogaValue getMinHeight();
|
||||
|
||||
public abstract void setMinHeight(float minHeight);
|
||||
|
||||
public abstract void setMinHeightPercent(float percent);
|
||||
|
||||
public abstract void setMinHeightMaxContent();
|
||||
|
||||
public abstract void setMinHeightFitContent();
|
||||
|
||||
public abstract void setMinHeightStretch();
|
||||
|
||||
public abstract YogaValue getMaxWidth();
|
||||
|
||||
public abstract void setMaxWidth(float maxWidth);
|
||||
|
||||
public abstract void setMaxWidthPercent(float percent);
|
||||
|
||||
public abstract void setMaxWidthMaxContent();
|
||||
|
||||
public abstract void setMaxWidthFitContent();
|
||||
|
||||
public abstract void setMaxWidthStretch();
|
||||
|
||||
public abstract YogaValue getMaxHeight();
|
||||
|
||||
public abstract void setMaxHeight(float maxheight);
|
||||
|
||||
public abstract void setMaxHeightPercent(float percent);
|
||||
|
||||
public abstract void setMaxHeightMaxContent();
|
||||
|
||||
public abstract void setMaxHeightFitContent();
|
||||
|
||||
public abstract void setMaxHeightStretch();
|
||||
|
||||
public abstract float getAspectRatio();
|
||||
|
||||
public abstract void setAspectRatio(float aspectRatio);
|
||||
@@ -240,8 +192,6 @@ public abstract class YogaNode implements YogaProps {
|
||||
|
||||
public abstract void setGap(YogaGutter gutter, float gapLength);
|
||||
|
||||
public abstract void setGapPercent(YogaGutter gutter, float gapLength);
|
||||
|
||||
public abstract float getLayoutX();
|
||||
|
||||
public abstract float getLayoutY();
|
||||
|
@@ -32,7 +32,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
private static final byte LAYOUT_BORDER_START_INDEX = 14;
|
||||
|
||||
@Nullable private YogaNodeJNIBase mOwner;
|
||||
@Nullable private YogaConfig mConfig;
|
||||
@Nullable private List<YogaNodeJNIBase> mChildren;
|
||||
@Nullable private YogaMeasureFunction mMeasureFunction;
|
||||
@Nullable private YogaBaselineFunction mBaselineFunction;
|
||||
@@ -58,7 +57,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
|
||||
YogaNodeJNIBase(YogaConfig config) {
|
||||
this(YogaNative.jni_YGNodeNewWithConfigJNI(((YogaConfigJNIBase) config).mNativePointer));
|
||||
mConfig = config; // makes sure the YogaConfig is not garbage collected
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -301,14 +299,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetPositionTypeJNI(mNativePointer, positionType.intValue());
|
||||
}
|
||||
|
||||
public YogaBoxSizing getBoxSizing() {
|
||||
return YogaBoxSizing.fromInt(YogaNative.jni_YGNodeStyleGetBoxSizingJNI(mNativePointer));
|
||||
}
|
||||
|
||||
public void setBoxSizing(YogaBoxSizing boxSizing) {
|
||||
YogaNative.jni_YGNodeStyleSetBoxSizingJNI(mNativePointer, boxSizing.intValue());
|
||||
}
|
||||
|
||||
public YogaWrap getWrap() {
|
||||
return YogaWrap.fromInt(YogaNative.jni_YGNodeStyleGetFlexWrapJNI(mNativePointer));
|
||||
}
|
||||
@@ -373,18 +363,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setFlexBasisStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMargin(YogaEdge edge) {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
|
||||
}
|
||||
@@ -433,10 +411,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetPositionPercentJNI(mNativePointer, edge.intValue(), percent);
|
||||
}
|
||||
|
||||
public void setPositionAuto(YogaEdge edge) {
|
||||
YogaNative.jni_YGNodeStyleSetPositionAutoJNI(mNativePointer, edge.intValue());
|
||||
}
|
||||
|
||||
public YogaValue getWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -453,18 +427,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -481,18 +443,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -505,18 +455,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMinHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -529,18 +467,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMinHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMinHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxWidth() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
|
||||
}
|
||||
@@ -553,18 +479,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxWidthMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxWidthStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public YogaValue getMaxHeight() {
|
||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
|
||||
}
|
||||
@@ -577,18 +491,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
|
||||
}
|
||||
|
||||
public void setMaxHeightMaxContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightFitContent() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public void setMaxHeightStretch() {
|
||||
YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer);
|
||||
}
|
||||
|
||||
public float getAspectRatio() {
|
||||
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
|
||||
}
|
||||
@@ -819,9 +721,4 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
public void setGap(YogaGutter gutter, float gapLength) {
|
||||
YogaNative.jni_YGNodeStyleSetGapJNI(mNativePointer, gutter.intValue(), gapLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGapPercent(YogaGutter gutter, float gapLength) {
|
||||
YogaNative.jni_YGNodeStyleSetGapPercentJNI(mNativePointer, gutter.intValue(), gapLength);
|
||||
}
|
||||
}
|
||||
|
@@ -15,33 +15,15 @@ public interface YogaProps {
|
||||
|
||||
void setWidthPercent(float percent);
|
||||
|
||||
void setWidthAuto();
|
||||
|
||||
void setWidthMaxContent();
|
||||
|
||||
void setWidthFitContent();
|
||||
|
||||
void setWidthStretch();
|
||||
|
||||
void setMinWidth(float minWidth);
|
||||
|
||||
void setMinWidthPercent(float percent);
|
||||
|
||||
void setMinWidthMaxContent();
|
||||
|
||||
void setMinWidthFitContent();
|
||||
|
||||
void setMinWidthStretch();
|
||||
|
||||
void setMaxWidth(float maxWidth);
|
||||
|
||||
void setMaxWidthPercent(float percent);
|
||||
|
||||
void setMaxWidthMaxContent();
|
||||
|
||||
void setMaxWidthFitContent();
|
||||
|
||||
void setMaxWidthStretch();
|
||||
void setWidthAuto();
|
||||
|
||||
/* Height properties */
|
||||
|
||||
@@ -49,33 +31,15 @@ public interface YogaProps {
|
||||
|
||||
void setHeightPercent(float percent);
|
||||
|
||||
void setHeightAuto();
|
||||
|
||||
void setHeightMaxContent();
|
||||
|
||||
void setHeightFitContent();
|
||||
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinHeight(float minHeight);
|
||||
|
||||
void setMinHeightPercent(float percent);
|
||||
|
||||
void setMinHeightMaxContent();
|
||||
|
||||
void setMinHeightFitContent();
|
||||
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxHeight(float maxHeight);
|
||||
|
||||
void setMaxHeightPercent(float percent);
|
||||
|
||||
void setMaxHeightMaxContent();
|
||||
|
||||
void setMaxHeightFitContent();
|
||||
|
||||
void setMaxHeightStretch();
|
||||
void setHeightAuto();
|
||||
|
||||
/* Margin properties */
|
||||
|
||||
@@ -117,12 +81,6 @@ public interface YogaProps {
|
||||
|
||||
void setFlexBasis(float flexBasis);
|
||||
|
||||
void setFlexBasisMaxContent();
|
||||
|
||||
void setFlexBasisFitContent();
|
||||
|
||||
void setFlexBasisStretch();
|
||||
|
||||
void setFlexDirection(YogaFlexDirection direction);
|
||||
|
||||
void setFlexGrow(float flexGrow);
|
||||
@@ -147,8 +105,6 @@ public interface YogaProps {
|
||||
|
||||
void setBaselineFunction(YogaBaselineFunction yogaBaselineFunction);
|
||||
|
||||
void setBoxSizing(YogaBoxSizing boxSizing);
|
||||
|
||||
/* Getters */
|
||||
|
||||
YogaValue getWidth();
|
||||
@@ -192,6 +148,4 @@ public interface YogaProps {
|
||||
YogaValue getPosition(YogaEdge edge);
|
||||
|
||||
float getBorder(YogaEdge edge);
|
||||
|
||||
YogaBoxSizing getBoxSizing();
|
||||
}
|
||||
|
@@ -13,10 +13,7 @@ public enum YogaUnit {
|
||||
UNDEFINED(0),
|
||||
POINT(1),
|
||||
PERCENT(2),
|
||||
AUTO(3),
|
||||
MAX_CONTENT(4),
|
||||
FIT_CONTENT(5),
|
||||
STRETCH(6);
|
||||
AUTO(3);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
@@ -34,9 +31,6 @@ public enum YogaUnit {
|
||||
case 1: return POINT;
|
||||
case 2: return PERCENT;
|
||||
case 3: return AUTO;
|
||||
case 4: return MAX_CONTENT;
|
||||
case 5: return FIT_CONTENT;
|
||||
case 6: return STRETCH;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@@ -33,10 +33,9 @@ namespace facebook::yoga::vanillajni {
|
||||
*
|
||||
* This class is very explicit in its behavior, and it does not allow to perform
|
||||
* unexpected conversions or unexpected ownership transfer. In practice, this
|
||||
* class acts as a unique pointer where the underlying JNI reference can have
|
||||
* one and just one owner. Transferring ownership is allowed but it is an
|
||||
* explicit operation (implemented via move semantics and also via explicitly
|
||||
* API calls).
|
||||
* class acts as a unique pointer where the underying JNI reference can have one
|
||||
* and just one owner. Transferring ownership is allowed but it is an explicit
|
||||
* operation (implemented via move semantics and also via explicitly API calls).
|
||||
*
|
||||
* Note that this class doesn't receive an explicit JNIEnv at construction time.
|
||||
* At destruction time it uses vanillajni::getCurrentEnv() to retrieve the
|
||||
@@ -63,7 +62,7 @@ class ScopedGlobalRef {
|
||||
*
|
||||
* @param globalRef the global reference to wrap. Can be NULL.
|
||||
*/
|
||||
explicit ScopedGlobalRef(T globalRef) : mGlobalRef(globalRef) {}
|
||||
ScopedGlobalRef(T globalRef) : mGlobalRef(globalRef) {}
|
||||
|
||||
/**
|
||||
* Equivalent to ScopedGlobalRef(NULL)
|
||||
@@ -73,12 +72,12 @@ class ScopedGlobalRef {
|
||||
/**
|
||||
* Move construction is allowed.
|
||||
*/
|
||||
ScopedGlobalRef(ScopedGlobalRef&& s) noexcept : mGlobalRef(s.release()) {}
|
||||
ScopedGlobalRef(ScopedGlobalRef&& s) : mGlobalRef(s.release()) {}
|
||||
|
||||
/**
|
||||
* Move assignment is allowed.
|
||||
*/
|
||||
ScopedGlobalRef& operator=(ScopedGlobalRef&& s) noexcept {
|
||||
ScopedGlobalRef& operator=(ScopedGlobalRef&& s) {
|
||||
reset(s.release());
|
||||
return *this;
|
||||
}
|
||||
|
@@ -35,10 +35,9 @@ namespace facebook::yoga::vanillajni {
|
||||
*
|
||||
* This class is very explicit in its behavior, and it does not allow to perform
|
||||
* unexpected conversions or unexpected ownership transfer. In practice, this
|
||||
* class acts as a unique pointer where the underlying JNI reference can have
|
||||
* one and just one owner. Transferring ownership is allowed but it is an
|
||||
* explicit operation (implemented via move semantics and also via explicitly
|
||||
* API calls).
|
||||
* class acts as a unique pointer where the underying JNI reference can have one
|
||||
* and just one owner. Transferring ownership is allowed but it is an explicit
|
||||
* operation (implemented via move semantics and also via explicitly API calls).
|
||||
*
|
||||
* As with standard JNI local references it is not a valid operation to keep a
|
||||
* reference around between different native method calls.
|
||||
@@ -71,13 +70,12 @@ class ScopedLocalRef {
|
||||
/**
|
||||
* Move construction is allowed.
|
||||
*/
|
||||
ScopedLocalRef(ScopedLocalRef&& s) noexcept
|
||||
: mEnv(s.mEnv), mLocalRef(s.release()) {}
|
||||
ScopedLocalRef(ScopedLocalRef&& s) : mEnv(s.mEnv), mLocalRef(s.release()) {}
|
||||
|
||||
/**
|
||||
* Move assignment is allowed.
|
||||
*/
|
||||
ScopedLocalRef& operator=(ScopedLocalRef&& s) noexcept {
|
||||
ScopedLocalRef& operator=(ScopedLocalRef&& s) {
|
||||
reset(s.release());
|
||||
mEnv = s.mEnv;
|
||||
return *this;
|
||||
|
@@ -36,7 +36,7 @@ class YGNodeEdges {
|
||||
BORDER = 4,
|
||||
};
|
||||
|
||||
explicit YGNodeEdges(YGNodeRef node) {
|
||||
YGNodeEdges(YGNodeRef node) {
|
||||
auto context = YGNodeContext{};
|
||||
context.asVoidPtr = YGNodeGetContext(node);
|
||||
edges_ = context.edgesSet;
|
||||
|
@@ -54,9 +54,7 @@ static void jni_YGConfigSetExperimentalFeatureEnabledJNI(
|
||||
jboolean enabled) {
|
||||
const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
|
||||
YGConfigSetExperimentalFeatureEnabled(
|
||||
config,
|
||||
static_cast<YGExperimentalFeature>(feature),
|
||||
static_cast<bool>(enabled));
|
||||
config, static_cast<YGExperimentalFeature>(feature), enabled);
|
||||
}
|
||||
|
||||
static void jni_YGConfigSetUseWebDefaultsJNI(
|
||||
@@ -65,7 +63,7 @@ static void jni_YGConfigSetUseWebDefaultsJNI(
|
||||
jlong nativePointer,
|
||||
jboolean useWebDefaults) {
|
||||
const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
|
||||
YGConfigSetUseWebDefaults(config, static_cast<bool>(useWebDefaults));
|
||||
YGConfigSetUseWebDefaults(config, useWebDefaults);
|
||||
}
|
||||
|
||||
static void jni_YGConfigSetPointScaleFactorJNI(
|
||||
@@ -163,7 +161,7 @@ static void jni_YGConfigSetLoggerJNI(
|
||||
auto context =
|
||||
reinterpret_cast<ScopedGlobalRef<jobject>*>(YGConfigGetContext(config));
|
||||
|
||||
if (logger != nullptr) {
|
||||
if (logger) {
|
||||
if (context == nullptr) {
|
||||
context = new ScopedGlobalRef<jobject>();
|
||||
YGConfigSetContext(config, context);
|
||||
@@ -227,15 +225,14 @@ static void jni_YGNodeSetIsReferenceBaselineJNI(
|
||||
jlong nativePointer,
|
||||
jboolean isReferenceBaseline) {
|
||||
YGNodeSetIsReferenceBaseline(
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<bool>(isReferenceBaseline));
|
||||
_jlong2YGNodeRef(nativePointer), isReferenceBaseline);
|
||||
}
|
||||
|
||||
static jboolean jni_YGNodeIsReferenceBaselineJNI(
|
||||
JNIEnv* /*env*/,
|
||||
jobject /*obj*/,
|
||||
jlong nativePointer) {
|
||||
return static_cast<jboolean>(
|
||||
YGNodeIsReferenceBaseline(_jlong2YGNodeRef(nativePointer)));
|
||||
return YGNodeIsReferenceBaseline(_jlong2YGNodeRef(nativePointer));
|
||||
}
|
||||
|
||||
static void jni_YGNodeRemoveAllChildrenJNI(
|
||||
@@ -343,7 +340,7 @@ static void jni_YGNodeCalculateLayoutJNI(
|
||||
try {
|
||||
PtrJNodeMapVanilla* layoutContext = nullptr;
|
||||
auto map = PtrJNodeMapVanilla{};
|
||||
if (nativePointers != nullptr) {
|
||||
if (nativePointers) {
|
||||
map = PtrJNodeMapVanilla{nativePointers, javaNodes};
|
||||
layoutContext = ↦
|
||||
}
|
||||
@@ -359,7 +356,7 @@ static void jni_YGNodeCalculateLayoutJNI(
|
||||
YGTransferLayoutOutputsRecursive(env, obj, root);
|
||||
} catch (const YogaJniException& jniException) {
|
||||
ScopedLocalRef<jthrowable> throwable = jniException.getThrowable();
|
||||
if (throwable.get() != nullptr) {
|
||||
if (throwable.get()) {
|
||||
env->Throw(throwable.get());
|
||||
}
|
||||
} catch (const std::logic_error& ex) {
|
||||
@@ -429,28 +426,6 @@ static void jni_YGNodeCopyStyleJNI(
|
||||
YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
||||
|
||||
#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \
|
||||
static void jni_YGNodeStyleSet##name##MaxContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##FitContentJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \
|
||||
} \
|
||||
static void jni_YGNodeStyleSet##name##StretchJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
||||
YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
static jlong jni_YGNodeStyleGet##name##JNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||
@@ -482,14 +457,6 @@ static void jni_YGNodeCopyStyleJNI(
|
||||
static_cast<float>(value)); \
|
||||
}
|
||||
|
||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(name) \
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||
static void jni_YGNodeStyleSet##name##AutoJNI( \
|
||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||
YGNodeStyleSet##name##Auto( \
|
||||
_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge)); \
|
||||
}
|
||||
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
|
||||
@@ -497,7 +464,6 @@ YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignItems);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignSelf);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGBoxSizing, BoxSizing);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
|
||||
YG_NODE_JNI_STYLE_PROP(jint, YGDisplay, Display);
|
||||
@@ -505,15 +471,15 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
||||
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight);
|
||||
YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
|
||||
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position);
|
||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Position);
|
||||
|
||||
static jlong jni_YGNodeStyleGetMarginJNI(
|
||||
JNIEnv* /*env*/,
|
||||
@@ -660,8 +626,8 @@ static YGSize YGJNIMeasureFunc(
|
||||
|
||||
uint32_t wBits = 0xFFFFFFFF & (measureResult >> 32);
|
||||
uint32_t hBits = 0xFFFFFFFF & measureResult;
|
||||
auto measuredWidth = std::bit_cast<float>(wBits);
|
||||
auto measuredHeight = std::bit_cast<float>(hBits);
|
||||
float measuredWidth = std::bit_cast<float>(wBits);
|
||||
float measuredHeight = std::bit_cast<float>(hBits);
|
||||
|
||||
return YGSize{measuredWidth, measuredHeight};
|
||||
} else {
|
||||
@@ -679,7 +645,7 @@ static void jni_YGNodeSetHasMeasureFuncJNI(
|
||||
jboolean hasMeasureFunc) {
|
||||
YGNodeSetMeasureFunc(
|
||||
_jlong2YGNodeRef(nativePointer),
|
||||
static_cast<bool>(hasMeasureFunc) ? YGJNIMeasureFunc : nullptr);
|
||||
hasMeasureFunc ? YGJNIMeasureFunc : nullptr);
|
||||
}
|
||||
|
||||
static float YGJNIBaselineFunc(YGNodeConstRef node, float width, float height) {
|
||||
@@ -703,7 +669,7 @@ static void jni_YGNodeSetHasBaselineFuncJNI(
|
||||
jboolean hasBaselineFunc) {
|
||||
YGNodeSetBaselineFunc(
|
||||
_jlong2YGNodeRef(nativePointer),
|
||||
static_cast<bool>(hasBaselineFunc) ? YGJNIBaselineFunc : nullptr);
|
||||
hasBaselineFunc ? YGJNIBaselineFunc : nullptr);
|
||||
}
|
||||
|
||||
static void jni_YGNodeSetAlwaysFormsContainingBlockJNI(
|
||||
@@ -712,8 +678,7 @@ static void jni_YGNodeSetAlwaysFormsContainingBlockJNI(
|
||||
jlong nativePointer,
|
||||
jboolean alwaysFormsContainingBlock) {
|
||||
YGNodeSetAlwaysFormsContainingBlock(
|
||||
_jlong2YGNodeRef(nativePointer),
|
||||
static_cast<bool>(alwaysFormsContainingBlock));
|
||||
_jlong2YGNodeRef(nativePointer), alwaysFormsContainingBlock);
|
||||
}
|
||||
|
||||
static jlong
|
||||
@@ -746,18 +711,6 @@ static void jni_YGNodeStyleSetGapJNI(
|
||||
static_cast<float>(gapLength));
|
||||
}
|
||||
|
||||
static void jni_YGNodeStyleSetGapPercentJNI(
|
||||
JNIEnv* /*env*/,
|
||||
jobject /*obj*/,
|
||||
jlong nativePointer,
|
||||
jint gutter,
|
||||
jfloat gapLength) {
|
||||
YGNodeStyleSetGapPercent(
|
||||
_jlong2YGNodeRef(nativePointer),
|
||||
static_cast<YGGutter>(gutter),
|
||||
static_cast<float>(gapLength));
|
||||
}
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
|
||||
|
||||
@@ -842,12 +795,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetPositionTypeJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetPositionTypeJNI},
|
||||
{"jni_YGNodeStyleGetBoxSizingJNI",
|
||||
"(J)I",
|
||||
(void*)jni_YGNodeStyleGetBoxSizingJNI},
|
||||
{"jni_YGNodeStyleSetBoxSizingJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetBoxSizingJNI},
|
||||
{"jni_YGNodeStyleGetFlexWrapJNI",
|
||||
"(J)I",
|
||||
(void*)jni_YGNodeStyleGetFlexWrapJNI},
|
||||
@@ -892,15 +839,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetFlexBasisAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisAutoJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisFitContentJNI},
|
||||
{"jni_YGNodeStyleSetFlexBasisStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetFlexBasisStretchJNI},
|
||||
{"jni_YGNodeStyleGetMarginJNI",
|
||||
"(JI)J",
|
||||
(void*)jni_YGNodeStyleGetMarginJNI},
|
||||
@@ -937,9 +875,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetPositionPercentJNI",
|
||||
"(JIF)V",
|
||||
(void*)jni_YGNodeStyleSetPositionPercentJNI},
|
||||
{"jni_YGNodeStyleSetPositionAutoJNI",
|
||||
"(JI)V",
|
||||
(void*)jni_YGNodeStyleSetPositionAutoJNI},
|
||||
{"jni_YGNodeStyleGetWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetWidthJNI},
|
||||
{"jni_YGNodeStyleSetWidthJNI", "(JF)V", (void*)jni_YGNodeStyleSetWidthJNI},
|
||||
{"jni_YGNodeStyleSetWidthPercentJNI",
|
||||
@@ -948,15 +883,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetWidthAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthAutoJNI},
|
||||
{"jni_YGNodeStyleSetWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI},
|
||||
{"jni_YGNodeStyleSetHeightJNI",
|
||||
"(JF)V",
|
||||
@@ -967,15 +893,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetHeightAutoJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightAutoJNI},
|
||||
{"jni_YGNodeStyleSetHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinWidthJNI},
|
||||
@@ -985,15 +902,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMinHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMinHeightJNI},
|
||||
@@ -1003,15 +911,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMinHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMinHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMinHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxWidthJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxWidthJNI},
|
||||
@@ -1021,15 +920,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxWidthPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxWidthStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxWidthStretchJNI},
|
||||
{"jni_YGNodeStyleGetMaxHeightJNI",
|
||||
"(J)J",
|
||||
(void*)jni_YGNodeStyleGetMaxHeightJNI},
|
||||
@@ -1039,15 +929,6 @@ static JNINativeMethod methods[] = {
|
||||
{"jni_YGNodeStyleSetMaxHeightPercentJNI",
|
||||
"(JF)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightPercentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightMaxContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightFitContentJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightFitContentJNI},
|
||||
{"jni_YGNodeStyleSetMaxHeightStretchJNI",
|
||||
"(J)V",
|
||||
(void*)jni_YGNodeStyleSetMaxHeightStretchJNI},
|
||||
{"jni_YGNodeStyleGetAspectRatioJNI",
|
||||
"(J)F",
|
||||
(void*)jni_YGNodeStyleGetAspectRatioJNI},
|
||||
@@ -1059,9 +940,6 @@ static JNINativeMethod methods[] = {
|
||||
(void*)jni_YGNodeSetHasMeasureFuncJNI},
|
||||
{"jni_YGNodeStyleGetGapJNI", "(JI)F", (void*)jni_YGNodeStyleGetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapJNI},
|
||||
{"jni_YGNodeStyleSetGapPercentJNI",
|
||||
"(JIF)V",
|
||||
(void*)jni_YGNodeStyleSetGapPercentJNI},
|
||||
{"jni_YGNodeSetHasBaselineFuncJNI",
|
||||
"(JZ)V",
|
||||
(void*)jni_YGNodeSetHasBaselineFuncJNI},
|
||||
|
@@ -25,7 +25,7 @@ YogaJniException::YogaJniException(jthrowable throwable) {
|
||||
throwable_ = newGlobalRef(getCurrentEnv(), throwable);
|
||||
}
|
||||
|
||||
YogaJniException::YogaJniException(YogaJniException&& rhs) noexcept
|
||||
YogaJniException::YogaJniException(YogaJniException&& rhs)
|
||||
: throwable_(std::move(rhs.throwable_)) {}
|
||||
|
||||
YogaJniException::YogaJniException(const YogaJniException& rhs) {
|
||||
|
@@ -22,9 +22,9 @@ class YogaJniException : public std::exception {
|
||||
|
||||
explicit YogaJniException(jthrowable throwable);
|
||||
|
||||
YogaJniException(YogaJniException&& rhs) noexcept;
|
||||
YogaJniException(YogaJniException&& rhs);
|
||||
|
||||
YogaJniException(const YogaJniException& rhs);
|
||||
YogaJniException(const YogaJniException& other);
|
||||
|
||||
ScopedLocalRef<jthrowable> getThrowable() const noexcept;
|
||||
|
||||
|
@@ -16,7 +16,7 @@ void registerNatives(
|
||||
size_t numMethods) {
|
||||
jclass clazz = env->FindClass(className);
|
||||
|
||||
assertNoPendingJniExceptionIf(env, clazz == nullptr);
|
||||
assertNoPendingJniExceptionIf(env, !clazz);
|
||||
|
||||
auto result =
|
||||
env->RegisterNatives(clazz, methods, static_cast<int32_t>(numMethods));
|
||||
@@ -31,7 +31,7 @@ jmethodID getStaticMethodId(
|
||||
const char* methodDescriptor) {
|
||||
jmethodID methodId =
|
||||
env->GetStaticMethodID(clazz, methodName, methodDescriptor);
|
||||
assertNoPendingJniExceptionIf(env, methodId == nullptr);
|
||||
assertNoPendingJniExceptionIf(env, !methodId);
|
||||
return methodId;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ jmethodID getMethodId(
|
||||
const char* methodName,
|
||||
const char* methodDescriptor) {
|
||||
jmethodID methodId = env->GetMethodID(clazz, methodName, methodDescriptor);
|
||||
assertNoPendingJniExceptionIf(env, methodId == nullptr);
|
||||
assertNoPendingJniExceptionIf(env, !methodId);
|
||||
return methodId;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ jfieldID getFieldId(
|
||||
const char* fieldName,
|
||||
const char* fieldSignature) {
|
||||
jfieldID fieldId = env->GetFieldID(clazz, fieldName, fieldSignature);
|
||||
assertNoPendingJniExceptionIf(env, fieldId == nullptr);
|
||||
assertNoPendingJniExceptionIf(env, !fieldId);
|
||||
return fieldId;
|
||||
}
|
||||
|
||||
@@ -82,14 +82,14 @@ callStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodId, ...) {
|
||||
va_start(args, methodId);
|
||||
jobject result = env->CallStaticObjectMethodV(clazz, methodId, args);
|
||||
va_end(args);
|
||||
assertNoPendingJniExceptionIf(env, result == nullptr);
|
||||
assertNoPendingJniExceptionIf(env, !result);
|
||||
return make_local_ref(env, result);
|
||||
}
|
||||
|
||||
ScopedGlobalRef<jobject> newGlobalRef(JNIEnv* env, jobject obj) {
|
||||
jobject result = env->NewGlobalRef(obj);
|
||||
|
||||
if (result == nullptr) {
|
||||
if (!result) {
|
||||
logErrorMessageAndDie("Could not obtain global reference from object");
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ ScopedGlobalRef<jobject> newGlobalRef(JNIEnv* env, jobject obj) {
|
||||
}
|
||||
|
||||
ScopedGlobalRef<jthrowable> newGlobalRef(JNIEnv* env, jthrowable obj) {
|
||||
auto result = static_cast<jthrowable>(env->NewGlobalRef(obj));
|
||||
jthrowable result = static_cast<jthrowable>(env->NewGlobalRef(obj));
|
||||
|
||||
if (result == nullptr) {
|
||||
if (!result) {
|
||||
logErrorMessageAndDie("Could not obtain global reference from object");
|
||||
}
|
||||
|
||||
|
@@ -12,9 +12,9 @@
|
||||
namespace facebook::yoga::vanillajni {
|
||||
|
||||
namespace {
|
||||
JavaVM* globalVm = nullptr;
|
||||
JavaVM* globalVm = NULL;
|
||||
struct JavaVMInitializer {
|
||||
explicit JavaVMInitializer(JavaVM* vm) {
|
||||
JavaVMInitializer(JavaVM* vm) {
|
||||
if (!vm) {
|
||||
logErrorMessageAndDie(
|
||||
"You cannot pass a NULL JavaVM to ensureInitialized");
|
||||
@@ -27,7 +27,7 @@ struct JavaVMInitializer {
|
||||
jint ensureInitialized(JNIEnv** env, JavaVM* vm) {
|
||||
static JavaVMInitializer init(vm);
|
||||
|
||||
if (env == nullptr) {
|
||||
if (!env) {
|
||||
logErrorMessageAndDie(
|
||||
"Need to pass a valid JNIEnv pointer to vanillajni initialization "
|
||||
"routine");
|
||||
@@ -43,7 +43,7 @@ jint ensureInitialized(JNIEnv** env, JavaVM* vm) {
|
||||
|
||||
// TODO why we need JNIEXPORT for getCurrentEnv ?
|
||||
JNIEXPORT JNIEnv* getCurrentEnv() {
|
||||
JNIEnv* env = nullptr;
|
||||
JNIEnv* env;
|
||||
jint ret = globalVm->GetEnv((void**)&env, JNI_VERSION_1_6);
|
||||
if (ret != JNI_OK) {
|
||||
logErrorMessageAndDie(
|
||||
@@ -68,7 +68,7 @@ void assertNoPendingJniException(JNIEnv* env) {
|
||||
}
|
||||
|
||||
auto throwable = env->ExceptionOccurred();
|
||||
if (throwable == nullptr) {
|
||||
if (!throwable) {
|
||||
logErrorMessageAndDie("Unable to get pending JNI exception.");
|
||||
}
|
||||
env->ExceptionClear();
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
using namespace facebook::yoga;
|
||||
|
||||
jint JNI_OnLoad(JavaVM* vm, void* /*unused*/) {
|
||||
JNIEnv* env = nullptr;
|
||||
jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||
JNIEnv* env;
|
||||
jint ret = vanillajni::ensureInitialized(&env, vm);
|
||||
YGJNIVanilla::registerNatives(env);
|
||||
return ret;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<c4a613bef526a87ca88e3b28e1abc215>>
|
||||
* @generated SignedSource<<ff8c3bfd84ae0fa4cc6ce4b728200f82>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAbsolutePositionTest {
|
||||
@@ -70,135 +69,6 @@ public class YGAbsolutePositionTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_auto_right() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPositionAuto(YogaEdge.LEFT);
|
||||
root_child0.setPosition(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_right_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPosition(YogaEdge.LEFT, 10f);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_left_auto_right_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setPositionAuto(YogaEdge.LEFT);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(10f);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_width_height_end_bottom() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
@@ -1487,162 +1357,6 @@ public class YGAbsolutePositionTest {
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_padding() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child0.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child0.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root_child0.setWidth(200f);
|
||||
root_child0.setHeight(200f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child0.setPadding(YogaEdge.LEFT, 50);
|
||||
root_child0_child0.setPadding(YogaEdge.TOP, 50);
|
||||
root_child0_child0.setPadding(YogaEdge.RIGHT, 50);
|
||||
root_child0_child0.setPadding(YogaEdge.BOTTOM, 50);
|
||||
root_child0_child0.setWidth(200f);
|
||||
root_child0_child0.setHeight(200f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child0_child0.setWidth(50f);
|
||||
root_child0_child0_child0.setHeight(50f);
|
||||
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_border() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child0.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child0.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root_child0.setWidth(200f);
|
||||
root_child0.setHeight(200f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child0.setBorder(YogaEdge.LEFT, 10f);
|
||||
root_child0_child0.setBorder(YogaEdge.TOP, 10f);
|
||||
root_child0_child0.setBorder(YogaEdge.RIGHT, 10f);
|
||||
root_child0_child0.setBorder(YogaEdge.BOTTOM, 10f);
|
||||
root_child0_child0.setWidth(200f);
|
||||
root_child0_child0.setHeight(200f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child0_child0.setWidth(50f);
|
||||
root_child0_child0_child0.setHeight(50f);
|
||||
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(220f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(140f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_absolute_layout_column_reverse_margin_border() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<cafd5a49032616243a68af66ae440904>>
|
||||
* @generated SignedSource<<d93836c91c231c9c029763da7dc2d911>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignContentTest {
|
||||
@@ -1746,98 +1745,6 @@ public class YGAlignContentTest {
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_between_wrapped_negative_space_row_reverse() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setBorder(YogaEdge.LEFT, 60f);
|
||||
root.setBorder(YogaEdge.TOP, 60f);
|
||||
root.setBorder(YogaEdge.RIGHT, 60f);
|
||||
root.setBorder(YogaEdge.BOTTOM, 60f);
|
||||
root.setWidth(320f);
|
||||
root.setHeight(320f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||
root_child0.setAlignContent(YogaAlign.SPACE_BETWEEN);
|
||||
root_child0.setWrap(YogaWrap.WRAP);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidthPercent(80f);
|
||||
root_child0_child0.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setWidthPercent(80f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setWidthPercent(80f);
|
||||
root_child0_child2.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_between_wrapped_negative_space_gap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
@@ -2199,17 +2106,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2227,109 +2134,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_around_wrapped_negative_space_row_reverse() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setBorder(YogaEdge.LEFT, 60f);
|
||||
root.setBorder(YogaEdge.TOP, 60f);
|
||||
root.setBorder(YogaEdge.RIGHT, 60f);
|
||||
root.setBorder(YogaEdge.BOTTOM, 60f);
|
||||
root.setWidth(320f);
|
||||
root.setHeight(320f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||
root_child0.setAlignContent(YogaAlign.SPACE_AROUND);
|
||||
root_child0.setWrap(YogaWrap.WRAP);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidthPercent(80f);
|
||||
root_child0_child0.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setWidthPercent(80f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setWidthPercent(80f);
|
||||
root_child0_child2.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2385,17 +2200,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2413,17 +2228,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2695,17 +2510,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2723,17 +2538,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2789,17 +2604,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2817,17 +2632,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -4415,12 +4230,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -4433,12 +4248,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -4481,12 +4296,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(7f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(7f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(7f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(207f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -4499,12 +4314,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(93f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(7f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(93f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(207f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -5207,305 +5022,6 @@ public class YGAlignContentTest {
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_flex_end_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.FLEX_END);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_START);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_flex_start_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.FLEX_START);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_center_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setAlignItems(YogaAlign.CENTER);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_stretch_and_align_items_stretch_with_flex_wrap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setAlignContent(YogaAlign.STRETCH);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setAlignSelf(YogaAlign.FLEX_END);
|
||||
root_child0.setWidth(150f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(120f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(120f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<e8d11c0e97041bb2f1487f0d87363fdc>>
|
||||
* @generated SignedSource<<17eb6adbebe0409ff047a82dc3257d91>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignItemsTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<90c29809153285d8773124e93961ba55>>
|
||||
* @generated SignedSource<<473604215dcf5ee686799fe2c2dc2004>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignSelfTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAlignSelfTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<245b1ad71f126cebcb48b66239bbc759>>
|
||||
* @generated SignedSource<<a6047e80a41c4f9d4de130eaba8f57c0>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAndroidNewsFeed.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAndroidNewsFeed {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<37a01c67158df025b1b43b8378071746>>
|
||||
* @generated SignedSource<<474f52d92a8fc32c66d5b5c1cc446124>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAspectRatioTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAspectRatioTest {
|
||||
@@ -179,46 +178,6 @@ public class YGAspectRatioTest {
|
||||
assertEquals(197f, root_child0_child0_child2_child0_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_zero_aspect_ratio_behaves_like_auto() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setAspectRatio(0 / 1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(250f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<d4e5fb968cdc2a3a64ddc14d21e8f867>>
|
||||
* @generated SignedSource<<c313aae6965f21b021d2dae0af1173bf>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBorderTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGBorderTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<6a430747c0b764e9fb683f023b45391a>>
|
||||
* @generated SignedSource<<0f79d7debf11777b10de09656cb38147>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDimensionTest {
|
393
java/tests/com/facebook/yoga/YGDisplayTest.java
Normal file
393
java/tests/com/facebook/yoga/YGDisplayTest.java
Normal file
@@ -0,0 +1,393 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<b1b955741beb678b9f3f72a74ad0ae50>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayTest.html
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDisplayTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_display_none() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_fixed_size() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(20f);
|
||||
root_child1.setHeight(20f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMargin(YogaEdge.LEFT, 10f);
|
||||
root_child0.setMargin(YogaEdge.TOP, 10f);
|
||||
root_child0.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root_child0.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root_child0.setWidth(20f);
|
||||
root_child0.setHeight(20f);
|
||||
root_child0.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_child() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setFlexShrink(1f);
|
||||
root_child0.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child1_child0 = createNode(config);
|
||||
root_child1_child0.setFlexGrow(1f);
|
||||
root_child1_child0.setFlexShrink(1f);
|
||||
root_child1_child0.setFlexBasisPercent(0f);
|
||||
root_child1_child0.setWidth(20f);
|
||||
root_child1.addChildAt(root_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setFlexGrow(1f);
|
||||
root_child2.setFlexShrink(1f);
|
||||
root_child2.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_position() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setPosition(YogaEdge.TOP, 10f);
|
||||
root_child1.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_display_none_with_position_absolute() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root_child0.setDisplay(YogaDisplay.NONE);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<5e698842feb033db77ff508df3f33b4a>>
|
||||
* @generated SignedSource<<4007f83eb3e84f3ee3fcf46d6d7be3bc>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexDirectionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexDirectionTest {
|
||||
@@ -4243,49 +4242,6 @@ public class YGFlexDirectionTest {
|
||||
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_flex_direction_alternating_with_percent() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(200f);
|
||||
root.setHeight(300f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root_child0.setPositionPercent(YogaEdge.LEFT, 10f);
|
||||
root_child0.setPositionPercent(YogaEdge.TOP, 10f);
|
||||
root_child0.setWidthPercent(50f);
|
||||
root_child0.setHeightPercent(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(120f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(30f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a33d3aa3ed335ded287fa37f788c321c>>
|
||||
* @generated SignedSource<<744d504e2ab572337ace7a2589bc3570>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f977e27ada480c9023d16368fae4fab2>>
|
||||
* @generated SignedSource<<ef62c060fc074248a6d6db6c619f38d4>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGFlexWrapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGFlexWrapTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<feba5f3f4c830be8a570d3a4c9deb8eb>>
|
||||
* @generated SignedSource<<f45f69191b808fe39b56a1473be47963>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGGapTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGGapTest {
|
||||
@@ -2217,925 +2216,6 @@ public class YGGapTest {
|
||||
assertEquals(30f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setPadding(YogaEdge.LEFT, 10);
|
||||
root.setPadding(YogaEdge.TOP, 10);
|
||||
root.setPadding(YogaEdge.RIGHT, 10);
|
||||
root.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(700f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_determines_parent_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setWidth(300f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_both_content_padding_and_item_padding() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setPadding(YogaEdge.LEFT, 10);
|
||||
root.setPadding(YogaEdge.TOP, 10);
|
||||
root.setPadding(YogaEdge.RIGHT, 10);
|
||||
root.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(700f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child0.setPadding(YogaEdge.TOP, 10);
|
||||
root_child0.setPadding(YogaEdge.RIGHT, 10);
|
||||
root_child0.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child1.setPadding(YogaEdge.TOP, 10);
|
||||
root_child1.setPadding(YogaEdge.RIGHT, 10);
|
||||
root_child1.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child2.setPadding(YogaEdge.TOP, 10);
|
||||
root_child2.setPadding(YogaEdge.RIGHT, 10);
|
||||
root_child2.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child3.setPadding(YogaEdge.TOP, 10);
|
||||
root_child3.setPadding(YogaEdge.RIGHT, 10);
|
||||
root_child3.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setPadding(YogaEdge.LEFT, 10);
|
||||
root_child4.setPadding(YogaEdge.TOP, 10);
|
||||
root_child4.setPadding(YogaEdge.RIGHT, 10);
|
||||
root_child4.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_both_content_padding() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setPadding(YogaEdge.LEFT, 10);
|
||||
root.setPadding(YogaEdge.TOP, 10);
|
||||
root.setPadding(YogaEdge.RIGHT, 10);
|
||||
root.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(700f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_content_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setMargin(YogaEdge.LEFT, 10f);
|
||||
root.setMargin(YogaEdge.TOP, 10f);
|
||||
root.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(700f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(170f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(170f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(340f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(170f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(170f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(340f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_content_margin_and_padding() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setMargin(YogaEdge.LEFT, 10f);
|
||||
root.setMargin(YogaEdge.TOP, 10f);
|
||||
root.setMargin(YogaEdge.RIGHT, 10f);
|
||||
root.setMargin(YogaEdge.BOTTOM, 10f);
|
||||
root.setPadding(YogaEdge.LEFT, 10);
|
||||
root.setPadding(YogaEdge.TOP, 10);
|
||||
root.setPadding(YogaEdge.RIGHT, 10);
|
||||
root.setPadding(YogaEdge.BOTTOM, 10);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(700f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(138f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(10f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(10f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(700f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(10f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(178f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(190f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(346f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_flexible_content() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexGrow(1f);
|
||||
root_child0.setFlexShrink(1f);
|
||||
root_child0.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setFlexGrow(1f);
|
||||
root_child2.setFlexShrink(1f);
|
||||
root_child2.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(110f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(220f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(220f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(110f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(80f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_row_gap_percent_wrapping_with_mixed_flexible_content() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(300f);
|
||||
root.setHeight(300f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setFlexGrow(1f);
|
||||
root_child1.setFlexShrink(1f);
|
||||
root_child1.setFlexBasisPercent(0f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidthPercent(10f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(270f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(290f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_row_gap_percent_wrapping_with_min_width() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWrap(YogaWrap.WRAP);
|
||||
root.setMinWidth(300f);
|
||||
root.setGapPercent(YogaGutter.COLUMN, 10f);
|
||||
root.setGapPercent(YogaGutter.ROW, 10f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(100f);
|
||||
root_child0.setHeight(100f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(100f);
|
||||
root_child1.setHeight(100f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(100f);
|
||||
root_child2.setHeight(100f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
|
||||
final YogaNode root_child3 = createNode(config);
|
||||
root_child3.setWidth(100f);
|
||||
root_child3.setHeight(100f);
|
||||
root.addChildAt(root_child3, 3);
|
||||
|
||||
final YogaNode root_child4 = createNode(config);
|
||||
root_child4.setWidth(100f);
|
||||
root_child4.setHeight(100f);
|
||||
root.addChildAt(root_child4, 4);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(130f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(70f, root_child3.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child3.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child4.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child4.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<ebd50ee9980922e7e6f3beabff5375ea>>
|
||||
* @generated SignedSource<<88d2dd510790179efc539f8d3cba00bb>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGJustifyContentTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGJustifyContentTest {
|
||||
@@ -837,7 +836,7 @@ public class YGJustifyContentTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_column_max_height_and_margin() {
|
||||
public void test_justify_content_colunn_max_height_and_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
@@ -1376,629 +1375,6 @@ public class YGJustifyContentTest {
|
||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_flex_start() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_flex_end() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.FLEX_END);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_center() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.CENTER);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-9f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(31f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(71f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(71f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(31f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-9f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_space_between() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_space_around() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.SPACE_AROUND);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_space_evenly() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.SPACE_EVENLY);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_justify_content_overflow_row_reverse_space_around() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root.setJustifyContent(YogaJustify.SPACE_AROUND);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void test_justify_content_overflow_row_reverse_space_evenly() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root.setJustifyContent(YogaJustify.SPACE_EVENLY);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_justify_content_overflow_row_space_evenly_auto_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setJustifyContent(YogaJustify.SPACE_EVENLY);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(102f);
|
||||
root.setHeight(102f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMarginAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(40f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(40f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(40f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(40f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(80f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(62f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(22f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-18f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<f9410af3e2849999ef3aec09cebbeef1>>
|
||||
* @generated SignedSource<<5dd3ad63c5d4b6fcbb3016005e08b162>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMarginTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGMarginTest {
|
||||
@@ -697,7 +696,7 @@ public class YGMarginTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_margin_auto_multiple_children_column() {
|
||||
public void test_margin_auto_mutiple_children_column() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
@@ -770,7 +769,7 @@ public class YGMarginTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_margin_auto_multiple_children_row() {
|
||||
public void test_margin_auto_mutiple_children_row() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
@@ -1733,63 +1732,6 @@ public class YGMarginTest {
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_margin_auto_overflowing_container() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setAlignItems(YogaAlign.CENTER);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(200f);
|
||||
root.setHeight(200f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMarginAuto(YogaEdge.BOTTOM);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(150f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(150f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(75f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(75f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<19cdc4fc9425af726b656ef628bab8af>>
|
||||
* @generated SignedSource<<857e5626695bb6b524eb6b609a6c7b55>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGMinMaxDimensionTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<6116c0f130b77b635a6551b3204c3cf8>>
|
||||
* @generated SignedSource<<176b6a98b0b08ef3f3fd20289e8fd089>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPaddingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGPaddingTest {
|
||||
@@ -274,48 +273,6 @@ public class YGPaddingTest {
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_physical_and_relative_edge_defined() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setPadding(YogaEdge.LEFT, 20);
|
||||
root.setPadding(YogaEdge.END, 50);
|
||||
root.setWidth(200f);
|
||||
root.setHeight(200f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidthPercent(100f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(130f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<27e18496d4ee880d9ba95ad0b2648071>>
|
||||
* @generated SignedSource<<baefd1632c2e9c66e4c42114856aa74f>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGPercentageTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGPercentageTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<06c18c6b3b9735644daf5b5bd0777eb8>>
|
||||
* @generated SignedSource<<40959004b04825e4f8f58e8a6d796047>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGRoundingTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGRoundingTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<26e773ec772f84370bc0f3f53d8221ed>>
|
||||
* @generated SignedSource<<debde6a37b3a2ad5892a15611a2fa8ec>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGSizeOverflowTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGSizeOverflowTest {
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<997d12880828a3c2881898b769618b43>>
|
||||
* @generated SignedSource<<3bbbf27ae54f7b245d6adad352761339>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGStaticPositionTest.html
|
||||
*/
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGStaticPositionTest {
|
||||
@@ -5887,144 +5886,6 @@ public class YGStaticPositionTest {
|
||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_static_position_absolute_child_multiple() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPadding(YogaEdge.LEFT, 100);
|
||||
root_child0.setPadding(YogaEdge.TOP, 100);
|
||||
root_child0.setPadding(YogaEdge.RIGHT, 100);
|
||||
root_child0.setPadding(YogaEdge.BOTTOM, 100);
|
||||
root_child0.setWidth(400f);
|
||||
root_child0.setHeight(400f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child0.setWidth(100f);
|
||||
root_child0_child0.setHeight(100f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||
root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child0_child0.setWidthPercent(10f);
|
||||
root_child0_child0_child0.setHeight(50f);
|
||||
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setPositionType(YogaPositionType.STATIC);
|
||||
root_child0_child1.setWidth(100f);
|
||||
root_child0_child1.setHeight(100f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child1_child0 = createNode(config);
|
||||
root_child0_child1_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child1_child0.setWidthPercent(50f);
|
||||
root_child0_child1_child0.setHeight(50f);
|
||||
root_child0_child1.addChildAt(root_child0_child1_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1_child1 = createNode(config);
|
||||
root_child0_child1_child1.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child1_child1.setWidthPercent(50f);
|
||||
root_child0_child1_child1.setHeight(50f);
|
||||
root_child0_child1.addChildAt(root_child0_child1_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root_child0_child2.setWidth(25f);
|
||||
root_child0_child2.setHeight(50f);
|
||||
root_child0.addChildAt(root_child0_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(200f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-100f, root_child0_child1_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(-100f, root_child0_child1_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0_child1_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(275f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga.utils;
|
||||
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import com.facebook.yoga.YogaMeasureFunction;
|
||||
import com.facebook.yoga.YogaNode;
|
||||
|
||||
public class TestUtils {
|
||||
|
||||
public static class intrinsicMeasureFunction implements YogaMeasureFunction {
|
||||
|
||||
private static float widthPerChar = 10;
|
||||
private static float heightPerChar = 10;
|
||||
|
||||
@Override
|
||||
public long measure(
|
||||
YogaNode node,
|
||||
float width,
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode) {
|
||||
String text = (String) node.getData();
|
||||
float measuredWidth;
|
||||
float measuredHeight;
|
||||
|
||||
if (widthMode == YogaMeasureMode.EXACTLY) {
|
||||
measuredWidth = width;
|
||||
} else if (widthMode == YogaMeasureMode.AT_MOST) {
|
||||
measuredWidth = Math.min(text.length() * widthPerChar, width);
|
||||
} else {
|
||||
measuredWidth = text.length() * widthPerChar;
|
||||
}
|
||||
|
||||
if (heightMode == YogaMeasureMode.EXACTLY) {
|
||||
measuredHeight = height;
|
||||
} else if (heightMode == YogaMeasureMode.AT_MOST) {
|
||||
measuredHeight =
|
||||
Math.min(
|
||||
caclulateHeight(text, Math.max(measuredWidth, getWidestWordWidth(text))), height);
|
||||
} else {
|
||||
measuredHeight = caclulateHeight(text, Math.max(measuredWidth, getWidestWordWidth(text)));
|
||||
}
|
||||
|
||||
return YogaMeasureOutput.make(measuredWidth, measuredHeight);
|
||||
}
|
||||
|
||||
static float getWidestWordWidth(String text) {
|
||||
int widestWordLength = 0;
|
||||
String[] words = text.split(" ");
|
||||
for (String word : words) {
|
||||
int wordLength = word.length();
|
||||
if (widestWordLength < wordLength) {
|
||||
widestWordLength = wordLength;
|
||||
}
|
||||
}
|
||||
return (float) widestWordLength * widthPerChar;
|
||||
}
|
||||
|
||||
static float caclulateHeight(String text, float measuredWidth) {
|
||||
if (text.length() * widthPerChar <= measuredWidth) {
|
||||
return heightPerChar;
|
||||
}
|
||||
|
||||
String[] words = text.split(" ");
|
||||
float lines = 1;
|
||||
float currentLineLength = 0;
|
||||
for (String word : words) {
|
||||
float wordWidth = word.length() * widthPerChar;
|
||||
if (wordWidth > measuredWidth) {
|
||||
if (currentLineLength > 0) {
|
||||
lines++;
|
||||
}
|
||||
lines++;
|
||||
currentLineLength = 0;
|
||||
} else if (currentLineLength + wordWidth <= measuredWidth) {
|
||||
currentLineLength += wordWidth + widthPerChar;
|
||||
} else {
|
||||
lines++;
|
||||
currentLineLength = wordWidth + widthPerChar;
|
||||
}
|
||||
}
|
||||
return (currentLineLength == 0 ? lines - 1 : lines) * heightPerChar;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,325 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<30103b31d09984d8443cf1ba544adeb7>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAutoTest.html
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGAutoTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_auto_width() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidthAuto();
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_height() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeightAuto();
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_flex_basis() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setWidth(50f);
|
||||
root_child0.setHeight(50f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child1 = createNode(config);
|
||||
root_child1.setWidth(50f);
|
||||
root_child1.setHeight(50f);
|
||||
root.addChildAt(root_child1, 1);
|
||||
|
||||
final YogaNode root_child2 = createNode(config);
|
||||
root_child2.setWidth(50f);
|
||||
root_child2.setHeight(50f);
|
||||
root.addChildAt(root_child2, 2);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(150f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_position() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setPositionAuto(YogaEdge.RIGHT);
|
||||
root_child0.setWidth(25f);
|
||||
root_child0.setHeight(25f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_auto_margin() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(50f);
|
||||
root.setHeight(50f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setMarginAuto(YogaEdge.LEFT);
|
||||
root_child0.setWidth(25f);
|
||||
root_child0.setHeight(25f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(50f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(25f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(25f, root_child0.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<be0d102e74e15f15050520f21afcaee1>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGDisplayContentsTest.html
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import com.facebook.yoga.utils.TestUtils;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class YGDisplayContentsTest {
|
||||
@Parameterized.Parameters(name = "{0}")
|
||||
public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
|
||||
return TestParametrization.nodeFactories();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;
|
||||
|
||||
@Test
|
||||
public void test_test1() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setWidth(100f);
|
||||
root.setHeight(100f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setDisplay(YogaDisplay.CONTENTS);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setFlexGrow(1f);
|
||||
root_child0_child0.setFlexShrink(1f);
|
||||
root_child0_child0.setFlexBasisPercent(0f);
|
||||
root_child0_child0.setHeight(10f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setFlexGrow(1f);
|
||||
root_child0_child1.setFlexShrink(1f);
|
||||
root_child0_child1.setFlexBasisPercent(0f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
root.setDirection(YogaDirection.LTR);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
root.setDirection(YogaDirection.RTL);
|
||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||
|
||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
private YogaNode createNode(YogaConfig config) {
|
||||
return mNodeFactory.create(config);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -29,12 +29,3 @@ node.free();
|
||||
## Requirements
|
||||
|
||||
`yoga-layout` requires a toolchain that supports ES Modules and top-level await.
|
||||
|
||||
If top-level-await is not supported, use the `yoga-layout/load` entry point instead. This requires to load yoga manually:
|
||||
|
||||
```ts
|
||||
import {loadYoga, Align} from 'yoga-layout/load';
|
||||
|
||||
const node = (await loadYoga).Node.create();
|
||||
node.setAlignContent(Align.Center);
|
||||
```
|
||||
|
@@ -13,17 +13,17 @@ const {
|
||||
logger,
|
||||
jestTask,
|
||||
option,
|
||||
parallel,
|
||||
series,
|
||||
spawn,
|
||||
task,
|
||||
tscTask,
|
||||
copyTask,
|
||||
} = require('just-scripts');
|
||||
|
||||
const {existsSync} = require('fs');
|
||||
const {readFile, writeFile, rm} = require('fs/promises');
|
||||
|
||||
const {glob} = require('glob');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
|
||||
@@ -58,32 +58,16 @@ task('prepack-package-json', async () => {
|
||||
const packageJsonContents = await readFile(packageJsonPath);
|
||||
const packageJson = JSON.parse(packageJsonContents.toString('utf-8'));
|
||||
|
||||
packageJson.main = packageJson.main.replace(
|
||||
/^.\/src\/(.*)\.ts/,
|
||||
'./dist/src/$1.js',
|
||||
);
|
||||
packageJson.types = packageJson.main.replace(/(.*)\.js/, '$1.d.ts');
|
||||
|
||||
recursiveReplace(
|
||||
packageJson.exports,
|
||||
/^.\/src\/(.*)\.ts/,
|
||||
'./dist/src/$1.js',
|
||||
);
|
||||
|
||||
recursiveReplace(packageJson, /(.\/src\/.*)\.ts/, '$1.js');
|
||||
packageJson.typings = packageJson.main.replace(/(.\/src\/.*)\.js/, '$1.d.ts');
|
||||
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||
});
|
||||
|
||||
task(
|
||||
'prepack',
|
||||
series(
|
||||
'build',
|
||||
copyTask({paths: ['binaries'], dest: 'dist/binaries'}),
|
||||
tscTask({
|
||||
emitDeclarationOnly: true,
|
||||
rootDir: '.',
|
||||
declarationDir: 'dist',
|
||||
}),
|
||||
babelTransformTask({src: 'src', dst: 'dist/src'}),
|
||||
parallel('build', tscTask({emitDeclarationOnly: true})),
|
||||
babelTransformTask({dir: 'src'}),
|
||||
'prepack-package-json',
|
||||
),
|
||||
);
|
||||
@@ -101,14 +85,14 @@ function recursiveReplace(obj, pattern, replacement) {
|
||||
function babelTransformTask(opts) {
|
||||
return () => {
|
||||
const args = [
|
||||
opts.src,
|
||||
opts.dir,
|
||||
'--source-maps',
|
||||
'--out-dir',
|
||||
opts.dst,
|
||||
opts.dir,
|
||||
'--extensions',
|
||||
'.js,.cjs,.mjs,.ts,.cts,.mts',
|
||||
];
|
||||
logger.info(`Transforming "${path.resolve(opts.src)}"`);
|
||||
logger.info(`Transforming "${path.resolve(opts.dir)}"`);
|
||||
|
||||
return spawn(node, [require.resolve('@babel/cli/bin/babel'), ...args], {
|
||||
cwd: __dirname,
|
||||
@@ -168,9 +152,9 @@ function installEmsdkTask() {
|
||||
{stdio: 'inherit'},
|
||||
);
|
||||
|
||||
await spawnShell(emsdkBin, ['install', emsdkVersion], {stdio: 'inherit'});
|
||||
await spawn(emsdkBin, ['install', emsdkVersion], {stdio: 'inherit'});
|
||||
|
||||
await spawnShell(emsdkBin, ['activate', emsdkVersion], {
|
||||
await spawn(emsdkBin, ['activate', emsdkVersion], {
|
||||
stdio: logger.enableVerbose ? 'inherit' : 'ignore',
|
||||
});
|
||||
};
|
||||
@@ -216,7 +200,7 @@ function emcmakeGenerateTask() {
|
||||
];
|
||||
logger.info(['emcmake', ...args].join(' '));
|
||||
|
||||
return spawnShell(emcmakeBin, args, {
|
||||
return spawn(emcmakeBin, args, {
|
||||
stdio: logger.enableVerbose ? 'inherit' : 'ignore',
|
||||
});
|
||||
};
|
||||
@@ -234,7 +218,7 @@ function cmakeBuildTask(opts) {
|
||||
];
|
||||
logger.info(['cmake', ...args].join(' '));
|
||||
|
||||
return spawnShell(cmake, args, {stdio: 'inherit'});
|
||||
return spawn(cmake, args, {stdio: 'inherit'});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -246,13 +230,8 @@ function clangFormatTask(opts) {
|
||||
];
|
||||
logger.info(['clang-format', ...args].join(' '));
|
||||
|
||||
return spawnShell(node, [require.resolve('clang-format'), ...args], {
|
||||
return spawn(node, [require.resolve('clang-format'), ...args], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function spawnShell(cmd, args, opts) {
|
||||
// https://github.com/nodejs/node/issues/52554
|
||||
return spawn(cmd, args, {...opts, shell: true});
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yoga-layout",
|
||||
"version": "0.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "An embeddable and performant flexbox layout engine with bindings for multiple languages",
|
||||
"license": "MIT",
|
||||
"author": "Meta Open Source",
|
||||
@@ -11,14 +11,8 @@
|
||||
},
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./load": "./src/load.ts"
|
||||
},
|
||||
"files": [
|
||||
"dist/binaries/**",
|
||||
"dist/src/**",
|
||||
"binaries/**",
|
||||
"src/**"
|
||||
],
|
||||
"scripts": {
|
||||
@@ -38,13 +32,14 @@
|
||||
"@babel/core": "^7.23.0",
|
||||
"@babel/preset-env": "^7.23.0",
|
||||
"@babel/preset-typescript": "^7.23.0",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/node": "^16.18.25",
|
||||
"@types/which": "^3.0.0",
|
||||
"@yogalayout/cmake-bin": "3.28.0-1",
|
||||
"babel-register-esm": "^1.2.5",
|
||||
"clang-format": "^1.8.0",
|
||||
"glob": "^10.4.2",
|
||||
"glob": "^8.0.3",
|
||||
"jest": "^29.3.1",
|
||||
"just-scripts": "^2.1.0",
|
||||
"ninja-binaries": "^1.11.1",
|
||||
|
@@ -75,10 +75,6 @@ void Node::copyStyle(Node const& other) {
|
||||
YGNodeCopyStyle(m_node, other.m_node);
|
||||
}
|
||||
|
||||
void Node::setBoxSizing(int boxSizing) {
|
||||
YGNodeStyleSetBoxSizing(m_node, static_cast<YGBoxSizing>(boxSizing));
|
||||
}
|
||||
|
||||
void Node::setPositionType(int positionType) {
|
||||
YGNodeStyleSetPositionType(m_node, static_cast<YGPositionType>(positionType));
|
||||
}
|
||||
@@ -91,10 +87,6 @@ void Node::setPositionPercent(int edge, double position) {
|
||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||
}
|
||||
|
||||
void Node::setPositionAuto(int edge) {
|
||||
YGNodeStyleSetPositionAuto(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
void Node::setAlignContent(int alignContent) {
|
||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||
}
|
||||
@@ -112,10 +104,6 @@ void Node::setFlexDirection(int flexDirection) {
|
||||
m_node, static_cast<YGFlexDirection>(flexDirection));
|
||||
}
|
||||
|
||||
void Node::setDirection(int direction) {
|
||||
YGNodeStyleSetDirection(m_node, static_cast<YGDirection>(direction));
|
||||
}
|
||||
|
||||
void Node::setFlexWrap(int flexWrap) {
|
||||
YGNodeStyleSetFlexWrap(m_node, static_cast<YGWrap>(flexWrap));
|
||||
}
|
||||
@@ -160,18 +148,6 @@ void Node::setFlexBasisAuto() {
|
||||
YGNodeStyleSetFlexBasisAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisMaxContent() {
|
||||
YGNodeStyleSetFlexBasisMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisFitContent() {
|
||||
YGNodeStyleSetFlexBasisFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisStretch() {
|
||||
YGNodeStyleSetFlexBasisStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexGrow(double flexGrow) {
|
||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||
}
|
||||
@@ -192,18 +168,6 @@ void Node::setWidthAuto() {
|
||||
YGNodeStyleSetWidthAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthMaxContent() {
|
||||
YGNodeStyleSetWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthFitContent() {
|
||||
YGNodeStyleSetWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthStretch() {
|
||||
YGNodeStyleSetWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeight(double height) {
|
||||
YGNodeStyleSetHeight(m_node, height);
|
||||
}
|
||||
@@ -216,18 +180,6 @@ void Node::setHeightAuto() {
|
||||
YGNodeStyleSetHeightAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightMaxContent() {
|
||||
YGNodeStyleSetHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightFitContent() {
|
||||
YGNodeStyleSetHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightStretch() {
|
||||
YGNodeStyleSetHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidth(double minWidth) {
|
||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||
}
|
||||
@@ -236,18 +188,6 @@ void Node::setMinWidthPercent(double minWidth) {
|
||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||
}
|
||||
|
||||
void Node::setMinWidthMaxContent() {
|
||||
YGNodeStyleSetMinWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthFitContent() {
|
||||
YGNodeStyleSetMinWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthStretch() {
|
||||
YGNodeStyleSetMinWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeight(double minHeight) {
|
||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||
}
|
||||
@@ -256,18 +196,6 @@ void Node::setMinHeightPercent(double minHeight) {
|
||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||
}
|
||||
|
||||
void Node::setMinHeightMaxContent() {
|
||||
YGNodeStyleSetMinHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightFitContent() {
|
||||
YGNodeStyleSetMinHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightStretch() {
|
||||
YGNodeStyleSetMinHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidth(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||
}
|
||||
@@ -276,18 +204,6 @@ void Node::setMaxWidthPercent(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthMaxContent() {
|
||||
YGNodeStyleSetMaxWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthFitContent() {
|
||||
YGNodeStyleSetMaxWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthStretch() {
|
||||
YGNodeStyleSetMaxWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeight(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||
}
|
||||
@@ -296,18 +212,6 @@ void Node::setMaxHeightPercent(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightMaxContent() {
|
||||
YGNodeStyleSetMaxHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightFitContent() {
|
||||
YGNodeStyleSetMaxHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightStretch() {
|
||||
YGNodeStyleSetMaxHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setAspectRatio(double aspectRatio) {
|
||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||
}
|
||||
@@ -332,14 +236,6 @@ void Node::setGap(int gutter, double gapLength) {
|
||||
YGNodeStyleSetGap(m_node, static_cast<YGGutter>(gutter), gapLength);
|
||||
}
|
||||
|
||||
void Node::setGapPercent(int gutter, double gapLength) {
|
||||
YGNodeStyleSetGapPercent(m_node, static_cast<YGGutter>(gutter), gapLength);
|
||||
}
|
||||
|
||||
int Node::getBoxSizing(void) const {
|
||||
return YGNodeStyleGetBoxSizing(m_node);
|
||||
}
|
||||
|
||||
int Node::getPositionType(void) const {
|
||||
return YGNodeStyleGetPositionType(m_node);
|
||||
}
|
||||
@@ -365,10 +261,6 @@ int Node::getFlexDirection(void) const {
|
||||
return YGNodeStyleGetFlexDirection(m_node);
|
||||
}
|
||||
|
||||
int Node::getDirection(void) const {
|
||||
return YGNodeStyleGetDirection(m_node);
|
||||
}
|
||||
|
||||
int Node::getFlexWrap(void) const {
|
||||
return YGNodeStyleGetFlexWrap(m_node);
|
||||
}
|
||||
@@ -521,14 +413,6 @@ bool Node::isDirty(void) const {
|
||||
return YGNodeIsDirty(m_node);
|
||||
}
|
||||
|
||||
void Node::markLayoutSeen() {
|
||||
YGNodeSetHasNewLayout(m_node, false);
|
||||
}
|
||||
|
||||
bool Node::hasNewLayout(void) const {
|
||||
return YGNodeGetHasNewLayout(m_node);
|
||||
}
|
||||
|
||||
void Node::calculateLayout(double width, double height, int direction) {
|
||||
YGNodeCalculateLayout(
|
||||
m_node, width, height, static_cast<YGDirection>(direction));
|
||||
|
@@ -76,7 +76,6 @@ class Node {
|
||||
void setPositionType(int positionType);
|
||||
void setPosition(int edge, double position);
|
||||
void setPositionPercent(int edge, double position);
|
||||
void setPositionAuto(int edge);
|
||||
|
||||
void setAlignContent(int alignContent);
|
||||
void setAlignItems(int alignItems);
|
||||
@@ -84,7 +83,6 @@ class Node {
|
||||
void setFlexDirection(int flexDirection);
|
||||
void setFlexWrap(int flexWrap);
|
||||
void setJustifyContent(int justifyContent);
|
||||
void setDirection(int direction);
|
||||
|
||||
void setMargin(int edge, double margin);
|
||||
void setMarginPercent(int edge, double margin);
|
||||
@@ -97,46 +95,25 @@ class Node {
|
||||
void setFlexBasis(double flexBasis);
|
||||
void setFlexBasisPercent(double flexBasis);
|
||||
void setFlexBasisAuto();
|
||||
void setFlexBasisMaxContent();
|
||||
void setFlexBasisFitContent();
|
||||
void setFlexBasisStretch();
|
||||
void setFlexGrow(double flexGrow);
|
||||
void setFlexShrink(double flexShrink);
|
||||
|
||||
void setWidth(double width);
|
||||
void setWidthPercent(double width);
|
||||
void setWidthAuto();
|
||||
void setWidthMaxContent();
|
||||
void setWidthFitContent();
|
||||
void setWidthStretch();
|
||||
void setHeight(double height);
|
||||
void setHeightPercent(double height);
|
||||
void setHeightAuto();
|
||||
void setHeightMaxContent();
|
||||
void setHeightFitContent();
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinWidth(double minWidth);
|
||||
void setMinWidthPercent(double minWidth);
|
||||
void setMinWidthMaxContent();
|
||||
void setMinWidthFitContent();
|
||||
void setMinWidthStretch();
|
||||
void setMinHeight(double minHeight);
|
||||
void setMinHeightPercent(double minHeight);
|
||||
void setMinHeightMaxContent();
|
||||
void setMinHeightFitContent();
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxWidth(double maxWidth);
|
||||
void setMaxWidthPercent(double maxWidth);
|
||||
void setMaxWidthMaxContent();
|
||||
void setMaxWidthFitContent();
|
||||
void setMaxWidthStretch();
|
||||
void setMaxHeight(double maxHeight);
|
||||
void setMaxHeightPercent(double maxHeight);
|
||||
void setMaxHeightMaxContent();
|
||||
void setMaxHeightFitContent();
|
||||
void setMaxHeightStretch();
|
||||
|
||||
void setAspectRatio(double aspectRatio);
|
||||
|
||||
@@ -146,9 +123,6 @@ class Node {
|
||||
void setPaddingPercent(int edge, double padding);
|
||||
|
||||
void setGap(int gutter, double gapLength);
|
||||
void setGapPercent(int gutter, double gapLength);
|
||||
|
||||
void setBoxSizing(int boxSizing);
|
||||
|
||||
public: // Style getters
|
||||
int getPositionType(void) const;
|
||||
@@ -160,7 +134,6 @@ class Node {
|
||||
int getFlexDirection(void) const;
|
||||
int getFlexWrap(void) const;
|
||||
int getJustifyContent(void) const;
|
||||
int getDirection(void) const;
|
||||
|
||||
Value getMargin(int edge) const;
|
||||
|
||||
@@ -188,8 +161,6 @@ class Node {
|
||||
|
||||
float getGap(int gutter);
|
||||
|
||||
int getBoxSizing(void) const;
|
||||
|
||||
public: // Tree hierarchy mutators
|
||||
void insertChild(Node* child, unsigned index);
|
||||
void removeChild(Node* child);
|
||||
@@ -224,8 +195,6 @@ class Node {
|
||||
public: // Dirtiness accessors
|
||||
void markDirty(void);
|
||||
bool isDirty(void) const;
|
||||
void markLayoutSeen();
|
||||
bool hasNewLayout(void) const;
|
||||
|
||||
public: // Layout mutators
|
||||
void calculateLayout(double width, double height, int direction);
|
||||
|
@@ -70,7 +70,6 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setPositionType", &Node::setPositionType)
|
||||
.function("setPosition", &Node::setPosition)
|
||||
.function("setPositionPercent", &Node::setPositionPercent)
|
||||
.function("setPositionAuto", &Node::setPositionAuto)
|
||||
|
||||
.function("setAlignContent", &Node::setAlignContent)
|
||||
.function("setAlignItems", &Node::setAlignItems)
|
||||
@@ -90,48 +89,25 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setFlexBasis", &Node::setFlexBasis)
|
||||
.function("setFlexBasisPercent", &Node::setFlexBasisPercent)
|
||||
.function("setFlexBasisAuto", &Node::setFlexBasisAuto)
|
||||
.function("setFlexBasisMaxContent", &Node::setFlexBasisMaxContent)
|
||||
.function("setFlexBasisFitContent", &Node::setFlexBasisFitContent)
|
||||
.function("setFlexBasisStretch", &Node::setFlexBasisStretch)
|
||||
.function("setFlexGrow", &Node::setFlexGrow)
|
||||
.function("setFlexShrink", &Node::setFlexShrink)
|
||||
|
||||
.function("setWidth", &Node::setWidth)
|
||||
.function("setWidthPercent", &Node::setWidthPercent)
|
||||
.function("setWidthAuto", &Node::setWidthAuto)
|
||||
.function("setWidthMaxContent", &Node::setWidthMaxContent)
|
||||
.function("setWidthFitContent", &Node::setWidthFitContent)
|
||||
.function("setWidthStretch", &Node::setWidthStretch)
|
||||
.function("setHeight", &Node::setHeight)
|
||||
.function("setHeightPercent", &Node::setHeightPercent)
|
||||
.function("setHeightAuto", &Node::setHeightAuto)
|
||||
.function("setHeightMaxContent", &Node::setHeightMaxContent)
|
||||
.function("setHeightFitContent", &Node::setHeightFitContent)
|
||||
.function("setHeightStretch", &Node::setHeightStretch)
|
||||
|
||||
.function("setMinWidth", &Node::setMinWidth)
|
||||
.function("setMinWidthPercent", &Node::setMinWidthPercent)
|
||||
.function("setMinWidthMaxContent", &Node::setMinWidthMaxContent)
|
||||
.function("setMinWidthFitContent", &Node::setMinWidthFitContent)
|
||||
.function("setMinWidthStretch", &Node::setMinWidthStretch)
|
||||
.function("setMinHeight", &Node::setMinHeight)
|
||||
.function("setMinHeightPercent", &Node::setMinHeightPercent)
|
||||
.function("setMinHeightMaxContent", &Node::setMinHeightMaxContent)
|
||||
.function("setMinHeightFitContent", &Node::setMinHeightFitContent)
|
||||
.function("setMinHeightStretch", &Node::setMinHeightStretch)
|
||||
|
||||
.function("setMaxWidth", &Node::setMaxWidth)
|
||||
.function("setMaxWidthPercent", &Node::setMaxWidthPercent)
|
||||
.function("setMaxWidthMaxContent", &Node::setMaxWidthMaxContent)
|
||||
.function("setMaxWidthFitContent", &Node::setMaxWidthFitContent)
|
||||
.function("setMaxWidthStretch", &Node::setMaxWidthStretch)
|
||||
.function("setMaxHeight", &Node::setMaxHeight)
|
||||
.function("setMaxHeightPercent", &Node::setMaxHeightPercent)
|
||||
.function("setMaxHeightMaxContent", &Node::setMaxHeightMaxContent)
|
||||
.function("setMaxHeightFitContent", &Node::setMaxHeightFitContent)
|
||||
.function("setMaxHeightStretch", &Node::setMaxHeightStretch)
|
||||
|
||||
.function("setBoxSizing", &Node::setBoxSizing)
|
||||
|
||||
.function("setAspectRatio", &Node::setAspectRatio)
|
||||
|
||||
@@ -140,9 +116,6 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setPadding", &Node::setPadding)
|
||||
.function("setPaddingPercent", &Node::setPaddingPercent)
|
||||
.function("setGap", &Node::setGap)
|
||||
.function("setGapPercent", &Node::setGapPercent)
|
||||
|
||||
.function("setDirection", &Node::setDirection)
|
||||
|
||||
.function("getPositionType", &Node::getPositionType)
|
||||
.function("getPosition", &Node::getPosition)
|
||||
@@ -169,8 +142,6 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("getMaxWidth", &Node::getMaxWidth)
|
||||
.function("getMaxHeight", &Node::getMaxHeight)
|
||||
|
||||
.function("getBoxSizing", &Node::getBoxSizing)
|
||||
|
||||
.function("getAspectRatio", &Node::getAspectRatio)
|
||||
|
||||
.function("getBorder", &Node::getBorder)
|
||||
@@ -204,9 +175,6 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("markDirty", &Node::markDirty)
|
||||
.function("isDirty", &Node::isDirty)
|
||||
|
||||
.function("markLayoutSeen", &Node::markLayoutSeen)
|
||||
.function("hasNewLayout", &Node::hasNewLayout)
|
||||
|
||||
.function("calculateLayout", &Node::calculateLayout)
|
||||
|
||||
.function("getComputedLeft", &Node::getComputedLeft)
|
||||
@@ -222,7 +190,5 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
|
||||
.function("getComputedMargin", &Node::getComputedMargin)
|
||||
.function("getComputedBorder", &Node::getComputedBorder)
|
||||
.function("getComputedPadding", &Node::getComputedPadding)
|
||||
|
||||
.function("getDirection", &Node::getDirection);
|
||||
.function("getComputedPadding", &Node::getComputedPadding);
|
||||
}
|
||||
|
@@ -19,11 +19,6 @@ export enum Align {
|
||||
SpaceEvenly = 8,
|
||||
}
|
||||
|
||||
export enum BoxSizing {
|
||||
BorderBox = 0,
|
||||
ContentBox = 1,
|
||||
}
|
||||
|
||||
export enum Dimension {
|
||||
Width = 0,
|
||||
Height = 1,
|
||||
@@ -38,7 +33,6 @@ export enum Direction {
|
||||
export enum Display {
|
||||
Flex = 0,
|
||||
None = 1,
|
||||
Contents = 2,
|
||||
}
|
||||
|
||||
export enum Edge {
|
||||
@@ -56,7 +50,7 @@ export enum Edge {
|
||||
export enum Errata {
|
||||
None = 0,
|
||||
StretchFlexBasis = 1,
|
||||
AbsolutePositionWithoutInsetsExcludesPadding = 2,
|
||||
AbsolutePositioningIncorrect = 2,
|
||||
AbsolutePercentAgainstInnerSize = 4,
|
||||
All = 2147483647,
|
||||
Classic = 2147483646,
|
||||
@@ -125,9 +119,6 @@ export enum Unit {
|
||||
Point = 1,
|
||||
Percent = 2,
|
||||
Auto = 3,
|
||||
MaxContent = 4,
|
||||
FitContent = 5,
|
||||
Stretch = 6,
|
||||
}
|
||||
|
||||
export enum Wrap {
|
||||
@@ -146,8 +137,6 @@ const constants = {
|
||||
ALIGN_SPACE_BETWEEN: Align.SpaceBetween,
|
||||
ALIGN_SPACE_AROUND: Align.SpaceAround,
|
||||
ALIGN_SPACE_EVENLY: Align.SpaceEvenly,
|
||||
BOX_SIZING_BORDER_BOX: BoxSizing.BorderBox,
|
||||
BOX_SIZING_CONTENT_BOX: BoxSizing.ContentBox,
|
||||
DIMENSION_WIDTH: Dimension.Width,
|
||||
DIMENSION_HEIGHT: Dimension.Height,
|
||||
DIRECTION_INHERIT: Direction.Inherit,
|
||||
@@ -155,7 +144,6 @@ const constants = {
|
||||
DIRECTION_RTL: Direction.RTL,
|
||||
DISPLAY_FLEX: Display.Flex,
|
||||
DISPLAY_NONE: Display.None,
|
||||
DISPLAY_CONTENTS: Display.Contents,
|
||||
EDGE_LEFT: Edge.Left,
|
||||
EDGE_TOP: Edge.Top,
|
||||
EDGE_RIGHT: Edge.Right,
|
||||
@@ -167,7 +155,7 @@ const constants = {
|
||||
EDGE_ALL: Edge.All,
|
||||
ERRATA_NONE: Errata.None,
|
||||
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
||||
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: Errata.AbsolutePositionWithoutInsetsExcludesPadding,
|
||||
ERRATA_ABSOLUTE_POSITIONING_INCORRECT: Errata.AbsolutePositioningIncorrect,
|
||||
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: Errata.AbsolutePercentAgainstInnerSize,
|
||||
ERRATA_ALL: Errata.All,
|
||||
ERRATA_CLASSIC: Errata.Classic,
|
||||
@@ -206,9 +194,6 @@ const constants = {
|
||||
UNIT_POINT: Unit.Point,
|
||||
UNIT_PERCENT: Unit.Percent,
|
||||
UNIT_AUTO: Unit.Auto,
|
||||
UNIT_MAX_CONTENT: Unit.MaxContent,
|
||||
UNIT_FIT_CONTENT: Unit.FitContent,
|
||||
UNIT_STRETCH: Unit.Stretch,
|
||||
WRAP_NO_WRAP: Wrap.NoWrap,
|
||||
WRAP_WRAP: Wrap.Wrap,
|
||||
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user