From 7eeabc19f9a5192c5d64c41a0e9577098b2f6f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Tue, 21 Mar 2017 15:54:27 +0000 Subject: [PATCH 1/4] Fix js implementation & tests of splitted config feature --- gentest/gentest-java.js | 2 +- gentest/gentest-javascript.js | 16 +- gentest/gentest.rb | 2 + javascript/binding.gyp | 1 + javascript/final-flags.gypi | 3 +- javascript/sources/Config.cc | 42 +++++ javascript/sources/Config.hh | 51 ++--- javascript/sources/Node.cc | 13 +- javascript/sources/Node.hh | 7 +- javascript/sources/entry-common.js | 32 ++-- javascript/sources/nbind.cc | 9 +- .../Facebook.Yoga/YGAbsolutePositionTest.js | 105 ++++++++--- .../tests/Facebook.Yoga/YGAlignContentTest.js | 133 +++++++++---- .../tests/Facebook.Yoga/YGAlignItemsTest.js | 133 +++++++++---- .../tests/Facebook.Yoga/YGAlignSelfTest.js | 35 +++- .../tests/Facebook.Yoga/YGBorderTest.js | 35 +++- .../tests/Facebook.Yoga/YGDimensionTest.js | 14 +- .../tests/Facebook.Yoga/YGDisplayTest.js | 35 +++- .../Facebook.Yoga/YGFlexDirectionTest.js | 42 +++-- javascript/tests/Facebook.Yoga/YGFlexTest.js | 49 +++-- .../tests/Facebook.Yoga/YGFlexWrapTest.js | 112 +++++++---- .../Facebook.Yoga/YGJustifyContentTest.js | 70 +++++-- .../tests/Facebook.Yoga/YGMarginTest.js | 175 +++++++++++++----- .../Facebook.Yoga/YGMinMaxDimensionTest.js | 144 +++++++++----- .../tests/Facebook.Yoga/YGPaddingTest.js | 42 +++-- .../tests/Facebook.Yoga/YGPercentageTest.js | 158 +++++++++------- .../tests/Facebook.Yoga/YGRoundingTest.js | 90 +++++---- .../tests/Facebook.Yoga/YGSizeOverflowTest.js | 21 ++- 28 files changed, 1072 insertions(+), 499 deletions(-) create mode 100644 javascript/sources/Config.cc diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index 26a02bc535..5f293d3e17 100644 --- a/gentest/gentest-java.js +++ b/gentest/gentest-java.js @@ -183,7 +183,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { }}, YGNodeStyleSetDisplay:{value:function(nodeName, value) { - this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');'); + this.push(nodeName + '.setDisplay(' + toValueJava(value) + ');'); }}, YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index 497fdb04c9..6278c59c6e 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -43,10 +43,12 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { emitTestPrologue:{value:function(name, experiments) { this.push('it(' + JSON.stringify(name) + ', function () {'); this.pushIndent(); + this.push('var config = Yoga.Config.create();'); + this.push(''); if (experiments.length > 0) { for (var i in experiments) { - this.push('Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_' + toJavascriptUpper(experiments[i]) + ', true);'); + this.push('config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_' + toJavascriptUpper(experiments[i]) + ', true);'); } this.push(''); } @@ -64,18 +66,12 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { this.push('} finally {'); this.pushIndent(); - this.push('if (typeof root !== "undefined") {'); + this.push('if (typeof root !== "undefined")'); this.pushIndent(); this.push('root.freeRecursive();'); this.popIndent(); - this.push('}'); - - if (experiments.length > 0) { - this.push(''); - for (var i in experiments) { - this.push('Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_' + toJavascriptUpper(experiments[i]) + ', false);'); - } - } + this.push(''); + this.push('config.free();'); this.popIndent(); this.push('}'); diff --git a/gentest/gentest.rb b/gentest/gentest.rb index 0aa290a3cc..3f794f4f50 100644 --- a/gentest/gentest.rb +++ b/gentest/gentest.rb @@ -48,6 +48,8 @@ f.write eval(logs[2].message.sub(/^[^"]*/, '')).sub('YogaTest', name) f.close + print logs[4] + f = File.open("../javascript/tests/Facebook.Yoga/#{name}.js", 'w') f.write eval(logs[3].message.sub(/^[^"]*/, '')).sub('YogaTest', name) f.close diff --git a/javascript/binding.gyp b/javascript/binding.gyp index a827e85180..bc00a0f939 100644 --- a/javascript/binding.gyp +++ b/javascript/binding.gyp @@ -9,6 +9,7 @@ "sources": [ "sources/yoga/YGNodeList.c", "sources/yoga/Yoga.c", + "sources/Config.cc", "sources/Node.cc", "sources/global.cc", "sources/nbind.cc" diff --git a/javascript/final-flags.gypi b/javascript/final-flags.gypi index 26f1787ca9..dd13e82712 100644 --- a/javascript/final-flags.gypi +++ b/javascript/final-flags.gypi @@ -4,7 +4,8 @@ [ "1==1", { "cflags_cc": [ - "-std=c++14" + "-std=c++14", + "-DNBIND_DUPLICATE_POINTERS" ], "xcode_settings": { diff --git a/javascript/sources/Config.cc b/javascript/sources/Config.cc new file mode 100644 index 0000000000..ac0090a846 --- /dev/null +++ b/javascript/sources/Config.cc @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#include + +#include "./Config.hh" + +/* static */ Config * Config::create(void) +{ + return new Config(); +} + +/* static */ void Config::destroy(Config * node) +{ + delete node; +} + +Config::Config(void) +: m_config(YGConfigNew()) +{ +} + +Config::~Config(void) +{ + YGConfigFree(m_config); +} + +void Config::setExperimentalFeatureEnabled(int feature, bool enabled) +{ + YGConfigSetExperimentalFeatureEnabled(m_config, static_cast(feature), enabled); +} + +bool Config::isExperimentalFeatureEnabled(int feature) const +{ + return YGConfigIsExperimentalFeatureEnabled(m_config, static_cast(feature)); +} diff --git a/javascript/sources/Config.hh b/javascript/sources/Config.hh index f70913536c..055f4d94e5 100644 --- a/javascript/sources/Config.hh +++ b/javascript/sources/Config.hh @@ -14,36 +14,39 @@ #include class Config { -private: - YGConfigRef m_config; - Config(void) - : m_config(YGConfigNew()) - {} + friend class Node; -public: + public: - static Config * create(void) - { - return new Config(); - } + static Config * create(void); - static void destroy(Config * config) - { - delete config; - } + static void destroy(Config * config); - ~Config(void) - { - YGConfigFree(m_config); - } + private: - void setExperimentalFeatureEnabled(int feature, bool enabled) - { - YGConfigSetExperimentalFeatureEnabled(m_config, static_cast(feature), enabled); - } + Config(void); - Config(Config const &) = delete; + public: + + ~Config(void); + + public: // Prevent accidental copy + + Config(Config const &) = delete; + + Config const & operator=(Config const &) = delete; + + public: // Setters + + void setExperimentalFeatureEnabled(int feature, bool enabled); + + public: // Getters + + bool isExperimentalFeatureEnabled(int feature) const; + + private: + + YGConfigRef m_config; - Config const & operator=(Config const &) = delete; }; diff --git a/javascript/sources/Node.cc b/javascript/sources/Node.cc index 32da21a141..339100062d 100644 --- a/javascript/sources/Node.cc +++ b/javascript/sources/Node.cc @@ -26,9 +26,14 @@ static YGSize globalMeasureFunc(YGNodeRef nodeRef, float width, YGMeasureMode wi return ygSize; } -/* static */ Node * Node::create(void) +/* static */ Node * Node::createDefault(void) { - return new Node(); + return new Node(nullptr); +} + +/* static */ Node * Node::createWithConfig(Config * config) +{ + return new Node(config); } /* static */ void Node::destroy(Node * node) @@ -41,8 +46,8 @@ static YGSize globalMeasureFunc(YGNodeRef nodeRef, float width, YGMeasureMode wi return reinterpret_cast(YGNodeGetContext(nodeRef)); } -Node::Node(void) -: m_node(YGNodeNew()) +Node::Node(Config * config) +: m_node(config != nullptr ? YGNodeNewWithConfig(config->m_config) : YGNodeNew()) , m_measureFunc(nullptr) { YGNodeSetContext(m_node, reinterpret_cast(this)); diff --git a/javascript/sources/Node.hh b/javascript/sources/Node.hh index 061d85a597..01757215a0 100644 --- a/javascript/sources/Node.hh +++ b/javascript/sources/Node.hh @@ -24,8 +24,9 @@ class Node { public: - static Node * create(void); - static Node * create(Config * config); + static Node * createDefault(void); + static Node * createWithConfig(Config * config); + static void destroy(Node * node); public: @@ -34,7 +35,7 @@ class Node { private: - Node(void); + Node(Config * config); public: diff --git a/javascript/sources/entry-common.js b/javascript/sources/entry-common.js index c97379a66b..880d08c0da 100644 --- a/javascript/sources/entry-common.js +++ b/javascript/sources/entry-common.js @@ -169,6 +169,22 @@ module.exports = function (bind, lib) { } + patch(lib.Config.prototype, `free`, function () { + + // Since we handle the memory allocation ourselves (via lib.Config.create), we also need to handle the deallocation + + lib.Config.destroy(this); + + }); + + patch(lib.Node, `create`, function (_, config) { + + // We decide the constructor we want to call depending on the parameters + + return config ? lib.Node.createWithConfig(config) : lib.Node.createDefault(); + + }); + patch(lib.Node.prototype, `free`, function () { // Since we handle the memory allocation ourselves (via lib.Node.create), we also need to handle the deallocation @@ -207,18 +223,6 @@ module.exports = function (bind, lib) { }); - function setExperimentalFeatureEnabled(... args) { - - return lib.setExperimentalFeatureEnabled(... args); - - } - - function isExperimentalFeatureEnabled(... args) { - - return lib.isExperimentalFeatureEnabled(... args); - - } - function getInstanceCount(... args) { return lib.getInstanceCount(... args); @@ -231,15 +235,13 @@ module.exports = function (bind, lib) { return Object.assign({ + Config: lib.Config, Node: lib.Node, Layout, Size, Value, - setExperimentalFeatureEnabled, - isExperimentalFeatureEnabled, - getInstanceCount }, constants); diff --git a/javascript/sources/nbind.cc b/javascript/sources/nbind.cc index 0be5a63668..acd28e1b9f 100644 --- a/javascript/sources/nbind.cc +++ b/javascript/sources/nbind.cc @@ -16,8 +16,6 @@ #include "./Config.hh" #include "./global.hh" -#define NBIND_DUPLICATE_POINTERS true - #include NBIND_GLOBAL() @@ -45,13 +43,18 @@ NBIND_CLASS(Value) NBIND_CLASS(Config) { method(create); + method(destroy); + method(setExperimentalFeatureEnabled); + + method(isExperimentalFeatureEnabled); } NBIND_CLASS(Node) { - method(create); + method(createDefault); + method(createWithConfig); method(destroy); method(reset); diff --git a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js index 5130a821a4..67289bd842 100644 --- a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js +++ b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("absolute_layout_width_height_start_top", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -48,12 +50,15 @@ it("absolute_layout_width_height_start_top", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_width_height_end_bottom", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -90,12 +95,15 @@ it("absolute_layout_width_height_end_bottom", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_start_top_end_bottom", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -132,12 +140,15 @@ it("absolute_layout_start_top_end_bottom", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_width_height_start_top_end_bottom", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -176,12 +187,15 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -233,12 +247,15 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_within_border", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setMargin(Yoga.EDGE_LEFT, 10); @@ -305,12 +322,15 @@ it("absolute_layout_within_border", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -348,12 +368,15 @@ it("absolute_layout_align_items_and_justify_content_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_flex_end", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); @@ -391,12 +414,15 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_justify_content_center", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -433,12 +459,15 @@ it("absolute_layout_justify_content_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_center", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -475,12 +504,15 @@ it("absolute_layout_align_items_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_center_on_child_only", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexGrow(1); @@ -517,12 +549,15 @@ it("absolute_layout_align_items_center_on_child_only", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -561,12 +596,15 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -605,12 +643,15 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -649,12 +690,15 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () { + const config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -693,8 +737,9 @@ it("absolute_layout_align_items_and_justify_content_center_and_right_position", console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js index a2f26cd792..8ae5dab8f9 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("align_content_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -107,12 +109,15 @@ it("align_content_flex_start", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_flex_start_without_height_on_children", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -204,12 +209,15 @@ it("align_content_flex_start_without_height_on_children", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_flex_start_with_flex", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -307,12 +315,15 @@ it("align_content_flex_start_with_flex", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_FLEX_END); @@ -408,12 +419,15 @@ it("align_content_flex_end", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); @@ -504,12 +518,15 @@ it("align_content_stretch", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_spacebetween", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -606,12 +623,15 @@ it("align_content_spacebetween", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_spacearound", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -708,12 +728,15 @@ it("align_content_spacearound", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -805,12 +828,15 @@ it("align_content_stretch_row", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_children", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -918,12 +944,15 @@ it("align_content_stretch_row_with_children", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_flex", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1021,12 +1050,15 @@ it("align_content_stretch_row_with_flex", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_flex_no_shrink", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1123,12 +1155,15 @@ it("align_content_stretch_row_with_flex_no_shrink", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_margin", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1228,12 +1263,15 @@ it("align_content_stretch_row_with_margin", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_padding", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1333,12 +1371,15 @@ it("align_content_stretch_row_with_padding", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_single_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1388,12 +1429,15 @@ it("align_content_stretch_row_with_single_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_fixed_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1486,12 +1530,15 @@ it("align_content_stretch_row_with_fixed_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_max_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1584,12 +1631,15 @@ it("align_content_stretch_row_with_max_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_row_with_min_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1682,12 +1732,15 @@ it("align_content_stretch_row_with_min_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); @@ -1797,12 +1850,15 @@ it("align_content_stretch_column", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_content_stretch_is_not_overriding_align_items", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); @@ -1854,8 +1910,9 @@ it("align_content_stretch_is_not_overriding_align_items", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js index edd37885a6..cd6d3db27e 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("align_items_stretch", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -44,12 +46,15 @@ it("align_items_stretch", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -84,12 +89,15 @@ it("align_items_center", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -124,12 +132,15 @@ it("align_items_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_END); @@ -164,12 +175,15 @@ it("align_items_flex_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -220,12 +234,15 @@ it("align_baseline", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -291,12 +308,15 @@ it("align_baseline_child", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_multiline", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -409,12 +429,15 @@ it("align_baseline_child_multiline", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_multiline_override", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -529,12 +552,15 @@ it("align_baseline_child_multiline_override", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_multiline_no_override_on_secondline", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -648,12 +674,15 @@ it("align_baseline_child_multiline_no_override_on_secondline", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_top", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -720,12 +749,15 @@ it("align_baseline_child_top", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_top2", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -792,12 +824,15 @@ it("align_baseline_child_top2", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_double_nested_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -878,12 +913,15 @@ it("align_baseline_double_nested_child", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(15 === root_child1_child0.getComputedHeight(), "15 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); @@ -933,12 +971,15 @@ it("align_baseline_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_margin", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1012,12 +1053,15 @@ it("align_baseline_child_margin", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_child_padding", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1091,12 +1135,15 @@ it("align_baseline_child_padding", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_multiline", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1208,12 +1255,15 @@ it("align_baseline_multiline", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_multiline_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); @@ -1324,12 +1374,15 @@ it("align_baseline_multiline_column", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_multiline_column2", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); @@ -1440,12 +1493,15 @@ it("align_baseline_multiline_column2", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_baseline_multiline_row_and_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1557,9 +1613,10 @@ it("align_baseline_multiline_row_and_column", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_center_child_with_margin_bigger_than_parent", function () { diff --git a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js index 37fe2dfb13..5eee73b514 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("align_self_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -46,12 +48,15 @@ it("align_self_center", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_self_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -86,12 +91,15 @@ it("align_self_flex_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_self_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -126,12 +134,15 @@ it("align_self_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_self_flex_end_override_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -167,12 +178,15 @@ it("align_self_flex_end_override_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_self_baseline", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -239,8 +253,9 @@ it("align_self_baseline", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGBorderTest.js b/javascript/tests/Facebook.Yoga/YGBorderTest.js index 895c44e8f2..da64c39113 100644 --- a/javascript/tests/Facebook.Yoga/YGBorderTest.js +++ b/javascript/tests/Facebook.Yoga/YGBorderTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("border_no_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); @@ -32,12 +34,15 @@ it("border_no_size", function () { console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("border_container_match_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); @@ -73,12 +78,15 @@ it("border_container_match_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("border_flex_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); @@ -116,12 +124,15 @@ it("border_flex_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("border_stretch_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); @@ -158,12 +169,15 @@ it("border_stretch_child", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("border_center_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -202,8 +216,9 @@ it("border_center_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGDimensionTest.js b/javascript/tests/Facebook.Yoga/YGDimensionTest.js index c39f9dfede..3b086fdcf3 100644 --- a/javascript/tests/Facebook.Yoga/YGDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGDimensionTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("wrap_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); @@ -43,12 +45,15 @@ it("wrap_child", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_grandchild", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); @@ -93,8 +98,9 @@ it("wrap_grandchild", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGDisplayTest.js b/javascript/tests/Facebook.Yoga/YGDisplayTest.js index 1755371b8f..d5b886d2c7 100644 --- a/javascript/tests/Facebook.Yoga/YGDisplayTest.js +++ b/javascript/tests/Facebook.Yoga/YGDisplayTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("display_none", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -60,12 +62,15 @@ it("display_none", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("display_none_fixed_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -115,12 +120,15 @@ it("display_none_fixed_size", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("display_none_with_margin", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -174,12 +182,15 @@ it("display_none_with_margin", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("display_none_with_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -267,12 +278,15 @@ it("display_none_with_child", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("display_none_with_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -322,8 +336,9 @@ it("display_none_with_position", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js index 25ef24fb7e..db144af928 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("flex_direction_column_no_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -71,12 +73,15 @@ it("flex_direction_column_no_height", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_direction_row_no_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -137,12 +142,15 @@ it("flex_direction_row_no_width", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_direction_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -203,12 +211,15 @@ it("flex_direction_column", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_direction_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -270,12 +281,15 @@ it("flex_direction_row", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_direction_column_reverse", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN_REVERSE); @@ -337,12 +351,15 @@ it("flex_direction_column_reverse", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_direction_row_reverse", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW_REVERSE); @@ -404,8 +421,9 @@ it("flex_direction_row_reverse", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGFlexTest.js b/javascript/tests/Facebook.Yoga/YGFlexTest.js index a0fa80dd13..08762f9515 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("flex_basis_flex_grow_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -59,12 +61,15 @@ it("flex_basis_flex_grow_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_basis_flex_grow_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -113,12 +118,15 @@ it("flex_basis_flex_grow_row", function () { console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_basis_flex_shrink_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -166,12 +174,15 @@ it("flex_basis_flex_shrink_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_basis_flex_shrink_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -220,12 +231,15 @@ it("flex_basis_flex_shrink_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_shrink_to_zero", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setHeight(75); @@ -289,12 +303,15 @@ it("flex_shrink_to_zero", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_basis_overrides_main_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -359,12 +376,15 @@ it("flex_basis_overrides_main_size", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_shrink_at_most", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -411,8 +431,9 @@ it("flex_grow_shrink_at_most", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js index 5b3b9bdab9..fcd0d33613 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("wrap_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -90,12 +92,15 @@ it("wrap_column", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -175,12 +180,15 @@ it("wrap_row", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_row_align_items_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -261,12 +269,15 @@ it("wrap_row_align_items_flex_end", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_row_align_items_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -347,12 +358,15 @@ it("wrap_row_align_items_center", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -404,12 +418,15 @@ it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { console.assert(55 === root_child1.getComputedWidth(), "55 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_wrap_wrap_to_child_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); @@ -486,12 +503,15 @@ it("flex_wrap_wrap_to_child_height", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_wrap_align_stretch_fits_one_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -540,12 +560,15 @@ it("flex_wrap_align_stretch_fits_one_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_row_align_content_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -640,12 +663,15 @@ it("wrap_reverse_row_align_content_flex_start", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_row_align_content_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -741,12 +767,15 @@ it("wrap_reverse_row_align_content_center", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_row_single_line_different_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -841,12 +870,15 @@ it("wrap_reverse_row_single_line_different_size", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_row_align_content_stretch", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -942,12 +974,15 @@ it("wrap_reverse_row_align_content_stretch", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_row_align_content_space_around", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1043,12 +1078,15 @@ it("wrap_reverse_row_align_content_space_around", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrap_reverse_column_fixed_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1144,12 +1182,15 @@ it("wrap_reverse_column_fixed_size", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrapped_row_within_align_items_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1214,12 +1255,15 @@ it("wrapped_row_within_align_items_center", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrapped_row_within_align_items_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -1284,12 +1328,15 @@ it("wrapped_row_within_align_items_flex_start", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("wrapped_row_within_align_items_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_END); @@ -1354,8 +1401,9 @@ it("wrapped_row_within_align_items_flex_end", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js index d2d71a386d..5f1c87ea31 100644 --- a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("justify_content_row_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -73,12 +75,15 @@ it("justify_content_row_flex_start", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_row_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -141,12 +146,15 @@ it("justify_content_row_flex_end", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_row_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -209,12 +217,15 @@ it("justify_content_row_center", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_row_space_between", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -277,12 +288,15 @@ it("justify_content_row_space_between", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_row_space_around", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -345,12 +359,15 @@ it("justify_content_row_space_around", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_column_flex_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(102); @@ -410,12 +427,15 @@ it("justify_content_column_flex_start", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_column_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); @@ -477,12 +497,15 @@ it("justify_content_column_flex_end", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_column_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -544,12 +567,15 @@ it("justify_content_column_center", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_column_space_between", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN); @@ -611,12 +637,15 @@ it("justify_content_column_space_between", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_column_space_around", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND); @@ -678,8 +707,9 @@ it("justify_content_column_space_around", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGMarginTest.js b/javascript/tests/Facebook.Yoga/YGMarginTest.js index 0ed2f1ca69..45c5007785 100644 --- a/javascript/tests/Facebook.Yoga/YGMarginTest.js +++ b/javascript/tests/Facebook.Yoga/YGMarginTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("margin_start", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -46,12 +48,15 @@ it("margin_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_top", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -85,12 +90,15 @@ it("margin_top", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -126,12 +134,15 @@ it("margin_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_bottom", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); @@ -166,12 +177,15 @@ it("margin_bottom", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_and_flex_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -207,12 +221,15 @@ it("margin_and_flex_row", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_and_flex_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -247,12 +264,15 @@ it("margin_and_flex_column", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_and_stretch_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -288,12 +308,15 @@ it("margin_and_stretch_row", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_and_stretch_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -328,12 +351,15 @@ it("margin_and_stretch_column", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_with_sibling_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -382,12 +408,15 @@ it("margin_with_sibling_row", function () { console.assert(45 === root_child1.getComputedWidth(), "45 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_with_sibling_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -435,12 +464,15 @@ it("margin_with_sibling_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(45 === root_child1.getComputedHeight(), "45 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_bottom", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -491,12 +523,15 @@ it("margin_auto_bottom", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_top", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -547,12 +582,15 @@ it("margin_auto_top", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_bottom_and_top", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -604,12 +642,15 @@ it("margin_auto_bottom_and_top", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_bottom_and_top_justify_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -661,12 +702,15 @@ it("margin_auto_bottom_and_top_justify_center", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_mutiple_children_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -733,12 +777,15 @@ it("margin_auto_mutiple_children_column", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_mutiple_children_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -806,12 +853,15 @@ it("margin_auto_mutiple_children_row", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_and_right_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -864,12 +914,15 @@ it("margin_auto_left_and_right_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_and_right", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -920,12 +973,15 @@ it("margin_auto_left_and_right", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_start_and_end_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -978,12 +1034,15 @@ it("margin_auto_start_and_end_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_start_and_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -1034,12 +1093,15 @@ it("margin_auto_start_and_end", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_and_right_column_and_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1091,12 +1153,15 @@ it("margin_auto_left_and_right_column_and_center", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1147,12 +1212,15 @@ it("margin_auto_left", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_right", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1203,12 +1271,15 @@ it("margin_auto_right", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_and_right_strech", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1260,12 +1331,15 @@ it("margin_auto_left_and_right_strech", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_top_and_bottom_strech", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -1316,9 +1390,10 @@ it("margin_auto_top_and_bottom_strech", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_should_not_be_part_of_max_height", function () { diff --git a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js index 431ffab814..64594870c2 100644 --- a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("max_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -45,12 +47,15 @@ it("max_width", function () { console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("max_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -85,12 +90,15 @@ it("max_height", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("min_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -138,12 +146,15 @@ it("min_height", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("min_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -192,12 +203,15 @@ it("min_width", function () { console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_min_max", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -233,12 +247,15 @@ it("justify_content_min_max", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_min_max", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -274,12 +291,15 @@ it("align_items_min_max", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("justify_content_overflow_min_max", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -344,13 +364,16 @@ it("justify_content_overflow_min_max", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_to_min", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); try { var root = Yoga.Node.create(config); @@ -400,15 +423,16 @@ it("flex_grow_to_min", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, false); + config.free(); } }); it("flex_grow_in_at_most_container", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); try { var root = Yoga.Node.create(config); @@ -459,14 +483,15 @@ it("flex_grow_in_at_most_container", function () { console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, false); + config.free(); } }); it("flex_grow_within_max_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -515,12 +540,15 @@ it("flex_grow_within_max_width", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_within_constrained_max_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -569,12 +597,15 @@ it("flex_grow_within_constrained_max_width", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_within_constrained_min_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -622,12 +653,15 @@ it("flex_grow_within_constrained_min_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_within_constrained_min_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setMinHeight(100); @@ -673,12 +707,15 @@ it("flex_grow_within_constrained_min_column", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_within_constrained_max_row", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -741,12 +778,15 @@ it("flex_grow_within_constrained_max_row", function () { console.assert(50 === root_child0_child1.getComputedWidth(), "50 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("flex_grow_within_constrained_max_column", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -794,12 +834,15 @@ it("flex_grow_within_constrained_max_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("min_width_overrides_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(50); @@ -818,12 +861,15 @@ it("min_width_overrides_width", function () { console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("max_width_overrides_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(200); @@ -842,12 +888,15 @@ it("max_width_overrides_width", function () { console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("min_height_overrides_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setHeight(50); @@ -866,12 +915,15 @@ it("min_height_overrides_height", function () { console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("max_height_overrides_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setHeight(200); @@ -890,12 +942,15 @@ it("max_height_overrides_height", function () { console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("min_max_percent_no_width_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -932,8 +987,9 @@ it("min_max_percent_no_width_height", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGPaddingTest.js b/javascript/tests/Facebook.Yoga/YGPaddingTest.js index 4f5bf2cb67..e8d9873220 100644 --- a/javascript/tests/Facebook.Yoga/YGPaddingTest.js +++ b/javascript/tests/Facebook.Yoga/YGPaddingTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("padding_no_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); @@ -32,12 +34,15 @@ it("padding_no_size", function () { console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("padding_container_match_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); @@ -73,12 +78,15 @@ it("padding_container_match_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("padding_flex_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); @@ -116,12 +124,15 @@ it("padding_flex_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("padding_stretch_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); @@ -158,12 +169,15 @@ it("padding_stretch_child", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("padding_center_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -202,12 +216,15 @@ it("padding_center_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("child_with_padding_align_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); @@ -247,8 +264,9 @@ it("child_with_padding_align_end", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGPercentageTest.js b/javascript/tests/Facebook.Yoga/YGPercentageTest.js index 6f5507fff7..78c73b1082 100644 --- a/javascript/tests/Facebook.Yoga/YGPercentageTest.js +++ b/javascript/tests/Facebook.Yoga/YGPercentageTest.js @@ -12,7 +12,9 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("percentage_width_height", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -48,15 +50,16 @@ it("percentage_width_height", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_position_left_top", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -94,15 +97,16 @@ it("percentage_position_left_top", function () { console.assert(180 === root_child0.getComputedWidth(), "180 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(220 === root_child0.getComputedHeight(), "220 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_position_bottom_right", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -140,15 +144,16 @@ it("percentage_position_bottom_right", function () { console.assert(275 === root_child0.getComputedWidth(), "275 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -199,15 +204,16 @@ it("percentage_flex_basis", function () { console.assert(75 === root_child1.getComputedWidth(), "75 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_cross", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -257,15 +263,16 @@ it("percentage_flex_basis_cross", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(75 === root_child1.getComputedHeight(), "75 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_cross_min_height", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -315,15 +322,16 @@ it("percentage_flex_basis_cross_min_height", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_main_max_height", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -376,15 +384,16 @@ it("percentage_flex_basis_main_max_height", function () { console.assert(148 === root_child1.getComputedWidth(), "148 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_cross_max_height", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -436,15 +445,16 @@ it("percentage_flex_basis_cross_max_height", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_main_max_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -497,15 +507,16 @@ it("percentage_flex_basis_main_max_width", function () { console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_cross_max_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -557,15 +568,16 @@ it("percentage_flex_basis_cross_max_width", function () { console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_main_min_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -618,15 +630,16 @@ it("percentage_flex_basis_main_min_width", function () { console.assert(80 === root_child1.getComputedWidth(), "80 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_flex_basis_cross_min_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -678,15 +691,16 @@ it("percentage_flex_basis_cross_min_width", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_multiple_nested_with_padding_margin_and_percentage_values", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -790,15 +804,16 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(142 === root_child1.getComputedHeight(), "142 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_margin_should_calculate_based_only_on_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -851,15 +866,16 @@ it("percentage_margin_should_calculate_based_only_on_width", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_padding_should_calculate_based_only_on_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -912,15 +928,16 @@ it("percentage_padding_should_calculate_based_only_on_width", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_absolute_position", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -958,14 +975,15 @@ it("percentage_absolute_position", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("percentage_width_height_undefined_parent_size", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); @@ -997,12 +1015,15 @@ it("percentage_width_height_undefined_parent_size", function () { console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("percent_within_flex_grow", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -1078,9 +1099,10 @@ it("percent_within_flex_grow", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("percentage_container_in_wrapping_container", function () { diff --git a/javascript/tests/Facebook.Yoga/YGRoundingTest.js b/javascript/tests/Facebook.Yoga/YGRoundingTest.js index 46e8b64d70..5ce6931a28 100644 --- a/javascript/tests/Facebook.Yoga/YGRoundingTest.js +++ b/javascript/tests/Facebook.Yoga/YGRoundingTest.js @@ -12,7 +12,9 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("rounding_flex_basis_flex_grow_row_width_of_100", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -75,15 +77,16 @@ it("rounding_flex_basis_flex_grow_row_width_of_100", function () { console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -174,15 +177,16 @@ it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_flex_basis_flex_shrink_row", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -246,15 +250,16 @@ it("rounding_flex_basis_flex_shrink_row", function () { console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_flex_basis_overrides_main_size", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -320,15 +325,16 @@ it("rounding_flex_basis_overrides_main_size", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_total_fractial", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -394,15 +400,16 @@ it("rounding_total_fractial", function () { console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_total_fractial_nested", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -502,15 +509,16 @@ it("rounding_total_fractial_nested", function () { console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_fractial_input_1", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -576,15 +584,16 @@ it("rounding_fractial_input_1", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_fractial_input_2", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -650,15 +659,16 @@ it("rounding_fractial_input_2", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_fractial_input_3", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -725,15 +735,16 @@ it("rounding_fractial_input_3", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); it("rounding_fractial_input_4", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, true); try { var root = Yoga.Node.create(config); @@ -800,10 +811,9 @@ it("rounding_fractial_input_4", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_ROUNDING, false); + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js index 603832f880..6acba15173 100644 --- a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js +++ b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js @@ -12,6 +12,8 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("nested_overflowing_child", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -58,12 +60,15 @@ it("nested_overflowing_child", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("nested_overflowing_child_in_constraint_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -112,12 +117,15 @@ it("nested_overflowing_child_in_constraint_parent", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("parent_wrap_child_size_overflowing_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -165,8 +173,9 @@ it("parent_wrap_child_size_overflowing_parent", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); From cd3c37658086cb898a0ad545181ad5809ba2f0c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 22 Mar 2017 01:24:03 +0000 Subject: [PATCH 2/4] Updates a few tests from the trunk --- .../Facebook.Yoga/YGAbsolutePositionTest.js | 30 ++++++------- .../tests/Facebook.Yoga/YGAlignItemsTest.js | 28 +++++++++---- .../tests/Facebook.Yoga/YGMarginTest.js | 42 +++++++++++++------ .../tests/Facebook.Yoga/YGPercentageTest.js | 16 ++++--- 4 files changed, 75 insertions(+), 41 deletions(-) diff --git a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js index 67289bd842..4068881542 100644 --- a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js +++ b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js @@ -12,7 +12,7 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY); it("absolute_layout_width_height_start_top", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -57,7 +57,7 @@ it("absolute_layout_width_height_start_top", function () { } }); it("absolute_layout_width_height_end_bottom", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -102,7 +102,7 @@ it("absolute_layout_width_height_end_bottom", function () { } }); it("absolute_layout_start_top_end_bottom", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -147,7 +147,7 @@ it("absolute_layout_start_top_end_bottom", function () { } }); it("absolute_layout_width_height_start_top_end_bottom", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -194,7 +194,7 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { } }); it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -254,7 +254,7 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent } }); it("absolute_layout_within_border", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -329,7 +329,7 @@ it("absolute_layout_within_border", function () { } }); it("absolute_layout_align_items_and_justify_content_center", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -375,7 +375,7 @@ it("absolute_layout_align_items_and_justify_content_center", function () { } }); it("absolute_layout_align_items_and_justify_content_flex_end", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -421,7 +421,7 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () { } }); it("absolute_layout_justify_content_center", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -466,7 +466,7 @@ it("absolute_layout_justify_content_center", function () { } }); it("absolute_layout_align_items_center", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -511,7 +511,7 @@ it("absolute_layout_align_items_center", function () { } }); it("absolute_layout_align_items_center_on_child_only", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -556,7 +556,7 @@ it("absolute_layout_align_items_center_on_child_only", function () { } }); it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -603,7 +603,7 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu } }); it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -650,7 +650,7 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", } }); it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); @@ -697,7 +697,7 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f } }); it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () { - const config = Yoga.Config.create(); + var config = Yoga.Config.create(); try { var root = Yoga.Node.create(config); diff --git a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js index cd6d3db27e..8e899eaf6a 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js @@ -1620,6 +1620,8 @@ it("align_baseline_multiline_row_and_column", function () { } }); it("align_items_center_child_with_margin_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1671,12 +1673,15 @@ it("align_items_center_child_with_margin_bigger_than_parent", function () { console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1728,12 +1733,15 @@ it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_center_child_without_margin_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1783,12 +1791,15 @@ it("align_items_center_child_without_margin_bigger_than_parent", function () { console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1838,8 +1849,9 @@ it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGMarginTest.js b/javascript/tests/Facebook.Yoga/YGMarginTest.js index 45c5007785..4bec007c0a 100644 --- a/javascript/tests/Facebook.Yoga/YGMarginTest.js +++ b/javascript/tests/Facebook.Yoga/YGMarginTest.js @@ -1397,6 +1397,8 @@ it("margin_auto_top_and_bottom_strech", function () { } }); it("margin_should_not_be_part_of_max_height", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(250); @@ -1432,12 +1434,15 @@ it("margin_should_not_be_part_of_max_height", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_should_not_be_part_of_max_width", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(250); @@ -1473,12 +1478,15 @@ it("margin_should_not_be_part_of_max_width", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_right_child_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1515,12 +1523,15 @@ it("margin_auto_left_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_child_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1556,12 +1567,15 @@ it("margin_auto_left_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_fix_left_auto_right_child_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1598,12 +1612,15 @@ it("margin_fix_left_auto_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); it("margin_auto_left_fix_right_child_bigger_than_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -1640,8 +1657,9 @@ it("margin_auto_left_fix_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); diff --git a/javascript/tests/Facebook.Yoga/YGPercentageTest.js b/javascript/tests/Facebook.Yoga/YGPercentageTest.js index 78c73b1082..73ea993250 100644 --- a/javascript/tests/Facebook.Yoga/YGPercentageTest.js +++ b/javascript/tests/Facebook.Yoga/YGPercentageTest.js @@ -1106,7 +1106,9 @@ it("percent_within_flex_grow", function () { } }); it("percentage_container_in_wrapping_container", function () { - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); + var config = Yoga.Config.create(); + + config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true); try { var root = Yoga.Node.create(config); @@ -1187,14 +1189,15 @@ it("percentage_container_in_wrapping_container", function () { console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } - Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, false); + config.free(); } }); it("percent_absolute_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(60); @@ -1259,8 +1262,9 @@ it("percent_absolute_position", function () { console.assert(60 === root_child0_child1.getComputedWidth(), "60 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(50 === root_child0_child1.getComputedHeight(), "50 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") { + if (typeof root !== "undefined") root.freeRecursive(); - } + + config.free(); } }); From ed48661765ee2359e6adcd355c00ade0f910d429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 22 Mar 2017 08:48:49 +0000 Subject: [PATCH 3/4] Fixes tests style --- gentest/gentest-javascript.js | 3 +- .../Facebook.Yoga/YGAbsolutePositionTest.js | 45 ++++++--- .../tests/Facebook.Yoga/YGAlignContentTest.js | 57 ++++++++---- .../tests/Facebook.Yoga/YGAlignItemsTest.js | 69 +++++++++----- .../tests/Facebook.Yoga/YGAlignSelfTest.js | 15 ++- .../tests/Facebook.Yoga/YGBorderTest.js | 15 ++- .../tests/Facebook.Yoga/YGDimensionTest.js | 6 +- .../tests/Facebook.Yoga/YGDisplayTest.js | 15 ++- .../Facebook.Yoga/YGFlexDirectionTest.js | 18 ++-- javascript/tests/Facebook.Yoga/YGFlexTest.js | 21 +++-- .../tests/Facebook.Yoga/YGFlexWrapTest.js | 48 ++++++---- .../Facebook.Yoga/YGJustifyContentTest.js | 30 ++++-- .../tests/Facebook.Yoga/YGMarginTest.js | 93 ++++++++++++------- .../Facebook.Yoga/YGMinMaxDimensionTest.js | 60 ++++++++---- .../tests/Facebook.Yoga/YGPaddingTest.js | 18 ++-- .../tests/Facebook.Yoga/YGPercentageTest.js | 60 ++++++++---- .../tests/Facebook.Yoga/YGRoundingTest.js | 30 ++++-- .../tests/Facebook.Yoga/YGSizeOverflowTest.js | 9 +- 18 files changed, 408 insertions(+), 204 deletions(-) diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index 6278c59c6e..0c3c74183b 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -66,10 +66,11 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { this.push('} finally {'); this.pushIndent(); - this.push('if (typeof root !== "undefined")'); + this.push('if (typeof root !== "undefined") {'); this.pushIndent(); this.push('root.freeRecursive();'); this.popIndent(); + this.push('}'); this.push(''); this.push('config.free();'); diff --git a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js index 4068881542..fa7f48a001 100644 --- a/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js +++ b/javascript/tests/Facebook.Yoga/YGAbsolutePositionTest.js @@ -50,8 +50,9 @@ it("absolute_layout_width_height_start_top", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -95,8 +96,9 @@ it("absolute_layout_width_height_end_bottom", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -140,8 +142,9 @@ it("absolute_layout_start_top_end_bottom", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -187,8 +190,9 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -247,8 +251,9 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -322,8 +327,9 @@ it("absolute_layout_within_border", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -368,8 +374,9 @@ it("absolute_layout_align_items_and_justify_content_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -414,8 +421,9 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -459,8 +467,9 @@ it("absolute_layout_justify_content_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -504,8 +513,9 @@ it("absolute_layout_align_items_center", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -549,8 +559,9 @@ it("absolute_layout_align_items_center_on_child_only", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -596,8 +607,9 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -643,8 +655,9 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -690,8 +703,9 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -737,8 +751,9 @@ it("absolute_layout_align_items_and_justify_content_center_and_right_position", console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js index 8ae5dab8f9..bd8bc1c898 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignContentTest.js @@ -109,8 +109,9 @@ it("align_content_flex_start", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -209,8 +210,9 @@ it("align_content_flex_start_without_height_on_children", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -315,8 +317,9 @@ it("align_content_flex_start_with_flex", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -419,8 +422,9 @@ it("align_content_flex_end", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -518,8 +522,9 @@ it("align_content_stretch", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -623,8 +628,9 @@ it("align_content_spacebetween", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -728,8 +734,9 @@ it("align_content_spacearound", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -828,8 +835,9 @@ it("align_content_stretch_row", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -944,8 +952,9 @@ it("align_content_stretch_row_with_children", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1050,8 +1059,9 @@ it("align_content_stretch_row_with_flex", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1155,8 +1165,9 @@ it("align_content_stretch_row_with_flex_no_shrink", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1263,8 +1274,9 @@ it("align_content_stretch_row_with_margin", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1371,8 +1383,9 @@ it("align_content_stretch_row_with_padding", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1429,8 +1442,9 @@ it("align_content_stretch_row_with_single_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1530,8 +1544,9 @@ it("align_content_stretch_row_with_fixed_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1631,8 +1646,9 @@ it("align_content_stretch_row_with_max_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1732,8 +1748,9 @@ it("align_content_stretch_row_with_min_height", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1850,8 +1867,9 @@ it("align_content_stretch_column", function () { console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1910,8 +1928,9 @@ it("align_content_stretch_is_not_overriding_align_items", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js index 8e899eaf6a..3a95b980fc 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignItemsTest.js @@ -46,8 +46,9 @@ it("align_items_stretch", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -89,8 +90,9 @@ it("align_items_center", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -132,8 +134,9 @@ it("align_items_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -175,8 +178,9 @@ it("align_items_flex_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -234,8 +238,9 @@ it("align_baseline", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -308,8 +313,9 @@ it("align_baseline_child", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -429,8 +435,9 @@ it("align_baseline_child_multiline", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -552,8 +559,9 @@ it("align_baseline_child_multiline_override", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -674,8 +682,9 @@ it("align_baseline_child_multiline_no_override_on_secondline", function () { console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -749,8 +758,9 @@ it("align_baseline_child_top", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -824,8 +834,9 @@ it("align_baseline_child_top2", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -913,8 +924,9 @@ it("align_baseline_double_nested_child", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(15 === root_child1_child0.getComputedHeight(), "15 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -971,8 +983,9 @@ it("align_baseline_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1053,8 +1066,9 @@ it("align_baseline_child_margin", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1135,8 +1149,9 @@ it("align_baseline_child_padding", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1255,8 +1270,9 @@ it("align_baseline_multiline", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1374,8 +1390,9 @@ it("align_baseline_multiline_column", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1493,8 +1510,9 @@ it("align_baseline_multiline_column2", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1613,8 +1631,9 @@ it("align_baseline_multiline_row_and_column", function () { console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1673,8 +1692,9 @@ it("align_items_center_child_with_margin_bigger_than_parent", function () { console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1733,8 +1753,9 @@ it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1791,8 +1812,9 @@ it("align_items_center_child_without_margin_bigger_than_parent", function () { console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1849,8 +1871,9 @@ it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js index 5eee73b514..c92c8e704b 100644 --- a/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js +++ b/javascript/tests/Facebook.Yoga/YGAlignSelfTest.js @@ -48,8 +48,9 @@ it("align_self_center", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -91,8 +92,9 @@ it("align_self_flex_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -134,8 +136,9 @@ it("align_self_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -178,8 +181,9 @@ it("align_self_flex_end_override_flex_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -253,8 +257,9 @@ it("align_self_baseline", function () { console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGBorderTest.js b/javascript/tests/Facebook.Yoga/YGBorderTest.js index da64c39113..c2ab7847d6 100644 --- a/javascript/tests/Facebook.Yoga/YGBorderTest.js +++ b/javascript/tests/Facebook.Yoga/YGBorderTest.js @@ -34,8 +34,9 @@ it("border_no_size", function () { console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -78,8 +79,9 @@ it("border_container_match_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -124,8 +126,9 @@ it("border_flex_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -169,8 +172,9 @@ it("border_stretch_child", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -216,8 +220,9 @@ it("border_center_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGDimensionTest.js b/javascript/tests/Facebook.Yoga/YGDimensionTest.js index 3b086fdcf3..cac5ba79b4 100644 --- a/javascript/tests/Facebook.Yoga/YGDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGDimensionTest.js @@ -45,8 +45,9 @@ it("wrap_child", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -98,8 +99,9 @@ it("wrap_grandchild", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGDisplayTest.js b/javascript/tests/Facebook.Yoga/YGDisplayTest.js index d5b886d2c7..92788f6486 100644 --- a/javascript/tests/Facebook.Yoga/YGDisplayTest.js +++ b/javascript/tests/Facebook.Yoga/YGDisplayTest.js @@ -62,8 +62,9 @@ it("display_none", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -120,8 +121,9 @@ it("display_none_fixed_size", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -182,8 +184,9 @@ it("display_none_with_margin", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -278,8 +281,9 @@ it("display_none_with_child", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -336,8 +340,9 @@ it("display_none_with_position", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js index db144af928..93e4520a25 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexDirectionTest.js @@ -73,8 +73,9 @@ it("flex_direction_column_no_height", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -142,8 +143,9 @@ it("flex_direction_row_no_width", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -211,8 +213,9 @@ it("flex_direction_column", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -281,8 +284,9 @@ it("flex_direction_row", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -351,8 +355,9 @@ it("flex_direction_column_reverse", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -421,8 +426,9 @@ it("flex_direction_row_reverse", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGFlexTest.js b/javascript/tests/Facebook.Yoga/YGFlexTest.js index 08762f9515..7cde347414 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexTest.js @@ -61,8 +61,9 @@ it("flex_basis_flex_grow_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -118,8 +119,9 @@ it("flex_basis_flex_grow_row", function () { console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -174,8 +176,9 @@ it("flex_basis_flex_shrink_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -231,8 +234,9 @@ it("flex_basis_flex_shrink_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -303,8 +307,9 @@ it("flex_shrink_to_zero", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -376,8 +381,9 @@ it("flex_basis_overrides_main_size", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -431,8 +437,9 @@ it("flex_grow_shrink_at_most", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js index fcd0d33613..1a101b499d 100644 --- a/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js +++ b/javascript/tests/Facebook.Yoga/YGFlexWrapTest.js @@ -92,8 +92,9 @@ it("wrap_column", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -180,8 +181,9 @@ it("wrap_row", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -269,8 +271,9 @@ it("wrap_row_align_items_flex_end", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -358,8 +361,9 @@ it("wrap_row_align_items_center", function () { console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -418,8 +422,9 @@ it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { console.assert(55 === root_child1.getComputedWidth(), "55 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -503,8 +508,9 @@ it("flex_wrap_wrap_to_child_height", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -560,8 +566,9 @@ it("flex_wrap_align_stretch_fits_one_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -663,8 +670,9 @@ it("wrap_reverse_row_align_content_flex_start", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -767,8 +775,9 @@ it("wrap_reverse_row_align_content_center", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -870,8 +879,9 @@ it("wrap_reverse_row_single_line_different_size", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -974,8 +984,9 @@ it("wrap_reverse_row_align_content_stretch", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1078,8 +1089,9 @@ it("wrap_reverse_row_align_content_space_around", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1182,8 +1194,9 @@ it("wrap_reverse_column_fixed_size", function () { console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1255,8 +1268,9 @@ it("wrapped_row_within_align_items_center", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1328,8 +1342,9 @@ it("wrapped_row_within_align_items_flex_start", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1401,8 +1416,9 @@ it("wrapped_row_within_align_items_flex_end", function () { console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js index 5f1c87ea31..20efc960c9 100644 --- a/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js +++ b/javascript/tests/Facebook.Yoga/YGJustifyContentTest.js @@ -75,8 +75,9 @@ it("justify_content_row_flex_start", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -146,8 +147,9 @@ it("justify_content_row_flex_end", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -217,8 +219,9 @@ it("justify_content_row_center", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -288,8 +291,9 @@ it("justify_content_row_space_between", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -359,8 +363,9 @@ it("justify_content_row_space_around", function () { console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -427,8 +432,9 @@ it("justify_content_column_flex_start", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -497,8 +503,9 @@ it("justify_content_column_flex_end", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -567,8 +574,9 @@ it("justify_content_column_center", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -637,8 +645,9 @@ it("justify_content_column_space_between", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -707,8 +716,9 @@ it("justify_content_column_space_around", function () { console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGMarginTest.js b/javascript/tests/Facebook.Yoga/YGMarginTest.js index 4bec007c0a..fb63931524 100644 --- a/javascript/tests/Facebook.Yoga/YGMarginTest.js +++ b/javascript/tests/Facebook.Yoga/YGMarginTest.js @@ -48,8 +48,9 @@ it("margin_start", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -90,8 +91,9 @@ it("margin_top", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -134,8 +136,9 @@ it("margin_end", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -177,8 +180,9 @@ it("margin_bottom", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -221,8 +225,9 @@ it("margin_and_flex_row", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -264,8 +269,9 @@ it("margin_and_flex_column", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -308,8 +314,9 @@ it("margin_and_stretch_row", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -351,8 +358,9 @@ it("margin_and_stretch_column", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -408,8 +416,9 @@ it("margin_with_sibling_row", function () { console.assert(45 === root_child1.getComputedWidth(), "45 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -464,8 +473,9 @@ it("margin_with_sibling_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(45 === root_child1.getComputedHeight(), "45 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -523,8 +533,9 @@ it("margin_auto_bottom", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -582,8 +593,9 @@ it("margin_auto_top", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -642,8 +654,9 @@ it("margin_auto_bottom_and_top", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -702,8 +715,9 @@ it("margin_auto_bottom_and_top_justify_center", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -777,8 +791,9 @@ it("margin_auto_mutiple_children_column", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -853,8 +868,9 @@ it("margin_auto_mutiple_children_row", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -914,8 +930,9 @@ it("margin_auto_left_and_right_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -973,8 +990,9 @@ it("margin_auto_left_and_right", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1034,8 +1052,9 @@ it("margin_auto_start_and_end_column", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1093,8 +1112,9 @@ it("margin_auto_start_and_end", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1153,8 +1173,9 @@ it("margin_auto_left_and_right_column_and_center", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1212,8 +1233,9 @@ it("margin_auto_left", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1271,8 +1293,9 @@ it("margin_auto_right", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1331,8 +1354,9 @@ it("margin_auto_left_and_right_strech", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1390,8 +1414,9 @@ it("margin_auto_top_and_bottom_strech", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1434,8 +1459,9 @@ it("margin_should_not_be_part_of_max_height", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1478,8 +1504,9 @@ it("margin_should_not_be_part_of_max_width", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1523,8 +1550,9 @@ it("margin_auto_left_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1567,8 +1595,9 @@ it("margin_auto_left_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1612,8 +1641,9 @@ it("margin_fix_left_auto_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1657,8 +1687,9 @@ it("margin_auto_left_fix_right_child_bigger_than_parent", function () { console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js index 64594870c2..137ec18cb5 100644 --- a/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js +++ b/javascript/tests/Facebook.Yoga/YGMinMaxDimensionTest.js @@ -47,8 +47,9 @@ it("max_width", function () { console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -90,8 +91,9 @@ it("max_height", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -146,8 +148,9 @@ it("min_height", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -203,8 +206,9 @@ it("min_width", function () { console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -247,8 +251,9 @@ it("justify_content_min_max", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -291,8 +296,9 @@ it("align_items_min_max", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -364,8 +370,9 @@ it("justify_content_overflow_min_max", function () { console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -423,8 +430,9 @@ it("flex_grow_to_min", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -483,8 +491,9 @@ it("flex_grow_in_at_most_container", function () { console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -540,8 +549,9 @@ it("flex_grow_within_max_width", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -597,8 +607,9 @@ it("flex_grow_within_constrained_max_width", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -653,8 +664,9 @@ it("flex_grow_within_constrained_min_row", function () { console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -707,8 +719,9 @@ it("flex_grow_within_constrained_min_column", function () { console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -778,8 +791,9 @@ it("flex_grow_within_constrained_max_row", function () { console.assert(50 === root_child0_child1.getComputedWidth(), "50 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -834,8 +848,9 @@ it("flex_grow_within_constrained_max_column", function () { console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -861,8 +876,9 @@ it("min_width_overrides_width", function () { console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -888,8 +904,9 @@ it("max_width_overrides_width", function () { console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -915,8 +932,9 @@ it("min_height_overrides_height", function () { console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -942,8 +960,9 @@ it("max_height_overrides_height", function () { console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -987,8 +1006,9 @@ it("min_max_percent_no_width_height", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGPaddingTest.js b/javascript/tests/Facebook.Yoga/YGPaddingTest.js index e8d9873220..ed97aaec63 100644 --- a/javascript/tests/Facebook.Yoga/YGPaddingTest.js +++ b/javascript/tests/Facebook.Yoga/YGPaddingTest.js @@ -34,8 +34,9 @@ it("padding_no_size", function () { console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -78,8 +79,9 @@ it("padding_container_match_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -124,8 +126,9 @@ it("padding_flex_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -169,8 +172,9 @@ it("padding_stretch_child", function () { console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -216,8 +220,9 @@ it("padding_center_child", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -264,8 +269,9 @@ it("child_with_padding_align_end", function () { console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGPercentageTest.js b/javascript/tests/Facebook.Yoga/YGPercentageTest.js index 73ea993250..f94761aac2 100644 --- a/javascript/tests/Facebook.Yoga/YGPercentageTest.js +++ b/javascript/tests/Facebook.Yoga/YGPercentageTest.js @@ -50,8 +50,9 @@ it("percentage_width_height", function () { console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -97,8 +98,9 @@ it("percentage_position_left_top", function () { console.assert(180 === root_child0.getComputedWidth(), "180 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(220 === root_child0.getComputedHeight(), "220 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -144,8 +146,9 @@ it("percentage_position_bottom_right", function () { console.assert(275 === root_child0.getComputedWidth(), "275 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -204,8 +207,9 @@ it("percentage_flex_basis", function () { console.assert(75 === root_child1.getComputedWidth(), "75 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -263,8 +267,9 @@ it("percentage_flex_basis_cross", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(75 === root_child1.getComputedHeight(), "75 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -322,8 +327,9 @@ it("percentage_flex_basis_cross_min_height", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -384,8 +390,9 @@ it("percentage_flex_basis_main_max_height", function () { console.assert(148 === root_child1.getComputedWidth(), "148 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -445,8 +452,9 @@ it("percentage_flex_basis_cross_max_height", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -507,8 +515,9 @@ it("percentage_flex_basis_main_max_width", function () { console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -568,8 +577,9 @@ it("percentage_flex_basis_cross_max_width", function () { console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -630,8 +640,9 @@ it("percentage_flex_basis_main_min_width", function () { console.assert(80 === root_child1.getComputedWidth(), "80 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -691,8 +702,9 @@ it("percentage_flex_basis_cross_min_width", function () { console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -804,8 +816,9 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); console.assert(142 === root_child1.getComputedHeight(), "142 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -866,8 +879,9 @@ it("percentage_margin_should_calculate_based_only_on_width", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -928,8 +942,9 @@ it("percentage_padding_should_calculate_based_only_on_width", function () { console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -975,8 +990,9 @@ it("percentage_absolute_position", function () { console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1015,8 +1031,9 @@ it("percentage_width_height_undefined_parent_size", function () { console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1099,8 +1116,9 @@ it("percent_within_flex_grow", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1189,8 +1207,9 @@ it("percentage_container_in_wrapping_container", function () { console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -1262,8 +1281,9 @@ it("percent_absolute_position", function () { console.assert(60 === root_child0_child1.getComputedWidth(), "60 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); console.assert(50 === root_child0_child1.getComputedHeight(), "50 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGRoundingTest.js b/javascript/tests/Facebook.Yoga/YGRoundingTest.js index 5ce6931a28..b41b7585b1 100644 --- a/javascript/tests/Facebook.Yoga/YGRoundingTest.js +++ b/javascript/tests/Facebook.Yoga/YGRoundingTest.js @@ -77,8 +77,9 @@ it("rounding_flex_basis_flex_grow_row_width_of_100", function () { console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -177,8 +178,9 @@ it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -250,8 +252,9 @@ it("rounding_flex_basis_flex_shrink_row", function () { console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -325,8 +328,9 @@ it("rounding_flex_basis_overrides_main_size", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -400,8 +404,9 @@ it("rounding_total_fractial", function () { console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -509,8 +514,9 @@ it("rounding_total_fractial_nested", function () { console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -584,8 +590,9 @@ it("rounding_fractial_input_1", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -659,8 +666,9 @@ it("rounding_fractial_input_2", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -735,8 +743,9 @@ it("rounding_fractial_input_3", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -811,8 +820,9 @@ it("rounding_fractial_input_4", function () { console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } diff --git a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js index 6acba15173..6818de0b06 100644 --- a/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js +++ b/javascript/tests/Facebook.Yoga/YGSizeOverflowTest.js @@ -60,8 +60,9 @@ it("nested_overflowing_child", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -117,8 +118,9 @@ it("nested_overflowing_child_in_constraint_parent", function () { console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } @@ -173,8 +175,9 @@ it("parent_wrap_child_size_overflowing_parent", function () { console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); } finally { - if (typeof root !== "undefined") + if (typeof root !== "undefined") { root.freeRecursive(); + } config.free(); } From b834ce8184371fa3b73824635b368a9b3baa18b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Wed, 22 Mar 2017 08:50:00 +0000 Subject: [PATCH 4/4] Fixes bindings style --- javascript/binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/binding.gyp b/javascript/binding.gyp index bc00a0f939..a08579a9b7 100644 --- a/javascript/binding.gyp +++ b/javascript/binding.gyp @@ -9,7 +9,7 @@ "sources": [ "sources/yoga/YGNodeList.c", "sources/yoga/Yoga.c", - "sources/Config.cc", + "sources/Config.cc", "sources/Node.cc", "sources/global.cc", "sources/nbind.cc"