From 36f6fa9861a41b6217edbdee3fc573e4d47581e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Tue, 28 Mar 2017 10:28:53 -0700 Subject: [PATCH] Fix tests of splitted config feature Summary: The following PR fixes the tests used in the javascript port (it modifies gentest.rb). These changes don't yet pass, it seems something is segfaulting somewhere. I have to check if it comes from nbind, the yoga library, or the node bridge itself. There's also some fails on the browser build, but it might be the same issue. Closes https://github.com/facebook/yoga/pull/487 Reviewed By: emilsjolander Differential Revision: D4778870 Pulled By: astreet fbshipit-source-id: 936fbca564ec89738c78e50c4402c53eb6867dec --- gentest/gentest-java.js | 2 +- gentest/gentest-javascript.js | 13 +- 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 | 60 +++++++++ .../tests/Facebook.Yoga/YGAlignContentTest.js | 76 +++++++++++ .../tests/Facebook.Yoga/YGAlignItemsTest.js | 92 +++++++++++++ .../tests/Facebook.Yoga/YGAlignSelfTest.js | 20 +++ .../tests/Facebook.Yoga/YGBorderTest.js | 20 +++ .../tests/Facebook.Yoga/YGDimensionTest.js | 8 ++ .../tests/Facebook.Yoga/YGDisplayTest.js | 20 +++ .../Facebook.Yoga/YGFlexDirectionTest.js | 24 ++++ javascript/tests/Facebook.Yoga/YGFlexTest.js | 28 ++++ .../tests/Facebook.Yoga/YGFlexWrapTest.js | 64 +++++++++ .../Facebook.Yoga/YGJustifyContentTest.js | 40 ++++++ .../tests/Facebook.Yoga/YGMarginTest.js | 124 ++++++++++++++++++ .../Facebook.Yoga/YGMinMaxDimensionTest.js | 84 +++++++++++- .../tests/Facebook.Yoga/YGPaddingTest.js | 24 ++++ .../tests/Facebook.Yoga/YGPercentageTest.js | 114 +++++++++++----- .../tests/Facebook.Yoga/YGRoundingTest.js | 60 ++++++--- .../tests/Facebook.Yoga/YGSizeOverflowTest.js | 12 ++ 28 files changed, 928 insertions(+), 117 deletions(-) create mode 100644 javascript/sources/Config.cc diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index 26a02bc5..5f293d3e 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 497fdb04..0c3c7418 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(''); } @@ -69,13 +71,8 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { 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 0aa290a3..3f794f4f 100644 --- a/gentest/gentest.rb +++ b/gentest/gentest.rb @@ -48,6 +48,8 @@ Dir['fixtures/*.html'].each do |file| 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 a827e851..a08579a9 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 26f1787c..dd13e827 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 00000000..ac0090a8 --- /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 f7091353..055f4d94 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 32da21a1..33910006 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 061d85a5..01757215 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 c97379a6..880d08c0 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 0be5a636..acd28e1b 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 5130a821..fa7f48a0 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 () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -51,9 +53,13 @@ it("absolute_layout_width_height_start_top", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_width_height_end_bottom", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -93,9 +99,13 @@ it("absolute_layout_width_height_end_bottom", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_start_top_end_bottom", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -135,9 +145,13 @@ it("absolute_layout_start_top_end_bottom", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_width_height_start_top_end_bottom", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setWidth(100); @@ -179,9 +193,13 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); @@ -236,9 +254,13 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_within_border", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setMargin(Yoga.EDGE_LEFT, 10); @@ -308,9 +330,13 @@ it("absolute_layout_within_border", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -351,9 +377,13 @@ it("absolute_layout_align_items_and_justify_content_center", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_flex_end", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); @@ -394,9 +424,13 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_justify_content_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -436,9 +470,13 @@ it("absolute_layout_justify_content_center", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_center", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -478,9 +516,13 @@ it("absolute_layout_align_items_center", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_center_on_child_only", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setFlexGrow(1); @@ -520,9 +562,13 @@ it("absolute_layout_align_items_center_on_child_only", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -564,9 +610,13 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -608,9 +658,13 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -652,9 +706,13 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); @@ -696,5 +754,7 @@ it("absolute_layout_align_items_and_justify_content_center_and_right_position", 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 a2f26cd7..bd8bc1c8 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); @@ -110,9 +112,13 @@ it("align_content_flex_start", function () { 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); @@ -207,9 +213,13 @@ it("align_content_flex_start_without_height_on_children", function () { 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); @@ -310,9 +320,13 @@ it("align_content_flex_start_with_flex", function () { 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); @@ -411,9 +425,13 @@ it("align_content_flex_end", function () { 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); @@ -507,9 +525,13 @@ it("align_content_stretch", function () { 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); @@ -609,9 +631,13 @@ it("align_content_spacebetween", function () { 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); @@ -711,9 +737,13 @@ it("align_content_spacearound", function () { 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); @@ -808,9 +838,13 @@ it("align_content_stretch_row", function () { 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); @@ -921,9 +955,13 @@ it("align_content_stretch_row_with_children", function () { 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); @@ -1024,9 +1062,13 @@ it("align_content_stretch_row_with_flex", function () { 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); @@ -1126,9 +1168,13 @@ it("align_content_stretch_row_with_flex_no_shrink", function () { 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); @@ -1231,9 +1277,13 @@ it("align_content_stretch_row_with_margin", function () { 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); @@ -1336,9 +1386,13 @@ it("align_content_stretch_row_with_padding", function () { 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); @@ -1391,9 +1445,13 @@ it("align_content_stretch_row_with_single_row", function () { 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); @@ -1489,9 +1547,13 @@ it("align_content_stretch_row_with_fixed_height", function () { 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); @@ -1587,9 +1649,13 @@ it("align_content_stretch_row_with_max_height", function () { 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); @@ -1685,9 +1751,13 @@ it("align_content_stretch_row_with_min_height", function () { 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); @@ -1800,9 +1870,13 @@ it("align_content_stretch_column", function () { 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); @@ -1857,5 +1931,7 @@ it("align_content_stretch_is_not_overriding_align_items", function () { 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 edd37885..3a95b980 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); @@ -47,9 +49,13 @@ it("align_items_stretch", function () { 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); @@ -87,9 +93,13 @@ it("align_items_center", function () { 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); @@ -127,9 +137,13 @@ it("align_items_flex_start", function () { 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); @@ -167,9 +181,13 @@ it("align_items_flex_end", function () { 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); @@ -223,9 +241,13 @@ it("align_baseline", function () { 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); @@ -294,9 +316,13 @@ it("align_baseline_child", function () { 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); @@ -412,9 +438,13 @@ it("align_baseline_child_multiline", function () { 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); @@ -532,9 +562,13 @@ it("align_baseline_child_multiline_override", function () { 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); @@ -651,9 +685,13 @@ it("align_baseline_child_multiline_no_override_on_secondline", function () { 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); @@ -723,9 +761,13 @@ it("align_baseline_child_top", function () { 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); @@ -795,9 +837,13 @@ it("align_baseline_child_top2", function () { 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); @@ -881,9 +927,13 @@ it("align_baseline_double_nested_child", function () { 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); @@ -936,9 +986,13 @@ it("align_baseline_column", function () { 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); @@ -1015,9 +1069,13 @@ it("align_baseline_child_margin", function () { 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); @@ -1094,9 +1152,13 @@ it("align_baseline_child_padding", function () { 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); @@ -1211,9 +1273,13 @@ it("align_baseline_multiline", function () { 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); @@ -1327,9 +1393,13 @@ it("align_baseline_multiline_column", function () { 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); @@ -1443,9 +1513,13 @@ it("align_baseline_multiline_column2", function () { 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); @@ -1560,9 +1634,13 @@ it("align_baseline_multiline_row_and_column", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); 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); @@ -1617,9 +1695,13 @@ it("align_items_center_child_with_margin_bigger_than_parent", function () { 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); @@ -1674,9 +1756,13 @@ it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { 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); @@ -1729,9 +1815,13 @@ it("align_items_center_child_without_margin_bigger_than_parent", function () { 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); @@ -1784,5 +1874,7 @@ it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { 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 37fe2dfb..c92c8e70 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); @@ -49,9 +51,13 @@ it("align_self_center", function () { 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); @@ -89,9 +95,13 @@ it("align_self_flex_end", function () { 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); @@ -129,9 +139,13 @@ it("align_self_flex_start", function () { 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); @@ -170,9 +184,13 @@ it("align_self_flex_end_override_flex_start", function () { 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); @@ -242,5 +260,7 @@ it("align_self_baseline", function () { 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 895c44e8..c2ab7847 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); @@ -35,9 +37,13 @@ it("border_no_size", function () { 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); @@ -76,9 +82,13 @@ it("border_container_match_child", function () { 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); @@ -119,9 +129,13 @@ it("border_flex_child", function () { 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); @@ -161,9 +175,13 @@ it("border_stretch_child", function () { 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); @@ -205,5 +223,7 @@ it("border_center_child", function () { 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 c39f9dfe..cac5ba79 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); @@ -46,9 +48,13 @@ it("wrap_child", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); it("wrap_grandchild", function () { + var config = Yoga.Config.create(); + try { var root = Yoga.Node.create(config); @@ -96,5 +102,7 @@ it("wrap_grandchild", function () { 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 1755371b..92788f64 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); @@ -63,9 +65,13 @@ it("display_none", function () { 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); @@ -118,9 +124,13 @@ it("display_none_fixed_size", function () { 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); @@ -177,9 +187,13 @@ it("display_none_with_margin", function () { 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); @@ -270,9 +284,13 @@ it("display_none_with_child", function () { 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); @@ -325,5 +343,7 @@ it("display_none_with_position", function () { 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 25ef24fb..93e4520a 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); @@ -74,9 +76,13 @@ it("flex_direction_column_no_height", function () { 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); @@ -140,9 +146,13 @@ it("flex_direction_row_no_width", function () { 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); @@ -206,9 +216,13 @@ it("flex_direction_column", function () { 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); @@ -273,9 +287,13 @@ it("flex_direction_row", function () { 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); @@ -340,9 +358,13 @@ it("flex_direction_column_reverse", function () { 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); @@ -407,5 +429,7 @@ it("flex_direction_row_reverse", function () { 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 a0fa80dd..7cde3474 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); @@ -62,9 +64,13 @@ it("flex_basis_flex_grow_column", function () { 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); @@ -116,9 +122,13 @@ it("flex_basis_flex_grow_row", function () { 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); @@ -169,9 +179,13 @@ it("flex_basis_flex_shrink_column", function () { 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); @@ -223,9 +237,13 @@ it("flex_basis_flex_shrink_row", function () { 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); @@ -292,9 +310,13 @@ it("flex_shrink_to_zero", function () { 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); @@ -362,9 +384,13 @@ it("flex_basis_overrides_main_size", function () { 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); @@ -414,5 +440,7 @@ it("flex_grow_shrink_at_most", function () { 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 5b3b9bda..1a101b49 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); @@ -93,9 +95,13 @@ it("wrap_column", function () { 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); @@ -178,9 +184,13 @@ it("wrap_row", function () { 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); @@ -264,9 +274,13 @@ it("wrap_row_align_items_flex_end", function () { 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); @@ -350,9 +364,13 @@ it("wrap_row_align_items_center", function () { 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); @@ -407,9 +425,13 @@ it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { 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); @@ -489,9 +511,13 @@ it("flex_wrap_wrap_to_child_height", function () { 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); @@ -543,9 +569,13 @@ it("flex_wrap_align_stretch_fits_one_row", function () { 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); @@ -643,9 +673,13 @@ it("wrap_reverse_row_align_content_flex_start", function () { 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); @@ -744,9 +778,13 @@ it("wrap_reverse_row_align_content_center", function () { 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); @@ -844,9 +882,13 @@ it("wrap_reverse_row_single_line_different_size", function () { 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); @@ -945,9 +987,13 @@ it("wrap_reverse_row_align_content_stretch", function () { 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); @@ -1046,9 +1092,13 @@ it("wrap_reverse_row_align_content_space_around", function () { 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); @@ -1147,9 +1197,13 @@ it("wrap_reverse_column_fixed_size", function () { 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); @@ -1217,9 +1271,13 @@ it("wrapped_row_within_align_items_center", function () { 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); @@ -1287,9 +1345,13 @@ it("wrapped_row_within_align_items_flex_start", function () { 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); @@ -1357,5 +1419,7 @@ it("wrapped_row_within_align_items_flex_end", function () { 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 d2d71a38..20efc960 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); @@ -76,9 +78,13 @@ it("justify_content_row_flex_start", function () { 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); @@ -144,9 +150,13 @@ it("justify_content_row_flex_end", function () { 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); @@ -212,9 +222,13 @@ it("justify_content_row_center", function () { 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); @@ -280,9 +294,13 @@ it("justify_content_row_space_between", function () { 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); @@ -348,9 +366,13 @@ it("justify_content_row_space_around", function () { 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); @@ -413,9 +435,13 @@ it("justify_content_column_flex_start", function () { 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); @@ -480,9 +506,13 @@ it("justify_content_column_flex_end", function () { 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); @@ -547,9 +577,13 @@ it("justify_content_column_center", function () { 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); @@ -614,9 +648,13 @@ it("justify_content_column_space_between", function () { 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); @@ -681,5 +719,7 @@ it("justify_content_column_space_around", function () { 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 0ed2f1ca..fb639315 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); @@ -49,9 +51,13 @@ it("margin_start", function () { 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); @@ -88,9 +94,13 @@ it("margin_top", function () { 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); @@ -129,9 +139,13 @@ it("margin_end", function () { 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); @@ -169,9 +183,13 @@ it("margin_bottom", function () { 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); @@ -210,9 +228,13 @@ it("margin_and_flex_row", function () { 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); @@ -250,9 +272,13 @@ it("margin_and_flex_column", function () { 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); @@ -291,9 +317,13 @@ it("margin_and_stretch_row", function () { 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); @@ -331,9 +361,13 @@ it("margin_and_stretch_column", function () { 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); @@ -385,9 +419,13 @@ it("margin_with_sibling_row", function () { 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); @@ -438,9 +476,13 @@ it("margin_with_sibling_column", function () { 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); @@ -494,9 +536,13 @@ it("margin_auto_bottom", function () { 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); @@ -550,9 +596,13 @@ it("margin_auto_top", function () { 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); @@ -607,9 +657,13 @@ it("margin_auto_bottom_and_top", function () { 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); @@ -664,9 +718,13 @@ it("margin_auto_bottom_and_top_justify_center", function () { 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); @@ -736,9 +794,13 @@ it("margin_auto_mutiple_children_column", function () { 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); @@ -809,9 +871,13 @@ it("margin_auto_mutiple_children_row", function () { 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); @@ -867,9 +933,13 @@ it("margin_auto_left_and_right_column", function () { 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); @@ -923,9 +993,13 @@ it("margin_auto_left_and_right", function () { 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); @@ -981,9 +1055,13 @@ it("margin_auto_start_and_end_column", function () { 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); @@ -1037,9 +1115,13 @@ it("margin_auto_start_and_end", function () { 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); @@ -1094,9 +1176,13 @@ it("margin_auto_left_and_right_column_and_center", function () { 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); @@ -1150,9 +1236,13 @@ it("margin_auto_left", function () { 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); @@ -1206,9 +1296,13 @@ it("margin_auto_right", function () { 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); @@ -1263,9 +1357,13 @@ it("margin_auto_left_and_right_strech", function () { 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); @@ -1319,9 +1417,13 @@ it("margin_auto_top_and_bottom_strech", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); 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); @@ -1360,9 +1462,13 @@ it("margin_should_not_be_part_of_max_height", function () { 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); @@ -1401,9 +1507,13 @@ it("margin_should_not_be_part_of_max_width", function () { 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); @@ -1443,9 +1553,13 @@ it("margin_auto_left_right_child_bigger_than_parent", function () { 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); @@ -1484,9 +1598,13 @@ it("margin_auto_left_child_bigger_than_parent", function () { 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); @@ -1526,9 +1644,13 @@ it("margin_fix_left_auto_right_child_bigger_than_parent", function () { 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); @@ -1568,5 +1690,7 @@ it("margin_auto_left_fix_right_child_bigger_than_parent", function () { 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 431ffab8..137ec18c 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); @@ -48,9 +50,13 @@ it("max_width", function () { 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); @@ -88,9 +94,13 @@ it("max_height", function () { 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); @@ -141,9 +151,13 @@ it("min_height", function () { 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); @@ -195,9 +209,13 @@ it("min_width", function () { 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); @@ -236,9 +254,13 @@ it("justify_content_min_max", function () { 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); @@ -277,9 +299,13 @@ it("align_items_min_max", function () { 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); @@ -347,10 +373,14 @@ it("justify_content_overflow_min_max", function () { 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); @@ -404,11 +434,13 @@ it("flex_grow_to_min", function () { 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); @@ -463,10 +495,12 @@ it("flex_grow_in_at_most_container", function () { 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); @@ -518,9 +552,13 @@ it("flex_grow_within_max_width", function () { 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); @@ -572,9 +610,13 @@ it("flex_grow_within_constrained_max_width", function () { 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); @@ -625,9 +667,13 @@ it("flex_grow_within_constrained_min_row", function () { 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); @@ -676,9 +722,13 @@ it("flex_grow_within_constrained_min_column", function () { 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); @@ -744,9 +794,13 @@ it("flex_grow_within_constrained_max_row", function () { 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); @@ -797,9 +851,13 @@ it("flex_grow_within_constrained_max_column", function () { 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); @@ -821,9 +879,13 @@ it("min_width_overrides_width", function () { 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); @@ -845,9 +907,13 @@ it("max_width_overrides_width", function () { 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); @@ -869,9 +935,13 @@ it("min_height_overrides_height", function () { 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); @@ -893,9 +963,13 @@ it("max_height_overrides_height", function () { 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); @@ -935,5 +1009,7 @@ it("min_max_percent_no_width_height", function () { 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 4f5bf2cb..ed97aaec 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); @@ -35,9 +37,13 @@ it("padding_no_size", function () { 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); @@ -76,9 +82,13 @@ it("padding_container_match_child", function () { 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); @@ -119,9 +129,13 @@ it("padding_flex_child", function () { 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); @@ -161,9 +175,13 @@ it("padding_stretch_child", function () { 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); @@ -205,9 +223,13 @@ it("padding_center_child", function () { 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); @@ -250,5 +272,7 @@ it("child_with_padding_align_end", function () { 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 6f5507ff..f94761aa 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); @@ -52,11 +54,13 @@ it("percentage_width_height", function () { 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); @@ -98,11 +102,13 @@ it("percentage_position_left_top", function () { 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); @@ -144,11 +150,13 @@ it("percentage_position_bottom_right", function () { 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); @@ -203,11 +211,13 @@ it("percentage_flex_basis", function () { 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); @@ -261,11 +271,13 @@ it("percentage_flex_basis_cross", function () { 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); @@ -319,11 +331,13 @@ it("percentage_flex_basis_cross_min_height", function () { 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); @@ -380,11 +394,13 @@ it("percentage_flex_basis_main_max_height", function () { 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); @@ -440,11 +456,13 @@ it("percentage_flex_basis_cross_max_height", function () { 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); @@ -501,11 +519,13 @@ it("percentage_flex_basis_main_max_width", function () { 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); @@ -561,11 +581,13 @@ it("percentage_flex_basis_cross_max_width", function () { 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); @@ -622,11 +644,13 @@ it("percentage_flex_basis_main_min_width", function () { 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); @@ -682,11 +706,13 @@ it("percentage_flex_basis_cross_min_width", function () { 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); @@ -794,11 +820,13 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct 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); @@ -855,11 +883,13 @@ it("percentage_margin_should_calculate_based_only_on_width", function () { 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); @@ -916,11 +946,13 @@ it("percentage_padding_should_calculate_based_only_on_width", function () { 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); @@ -962,10 +994,12 @@ it("percentage_absolute_position", function () { 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); @@ -1000,9 +1034,13 @@ it("percentage_width_height_undefined_parent_size", function () { 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); @@ -1081,10 +1119,14 @@ it("percent_within_flex_grow", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } }); 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); @@ -1169,10 +1211,12 @@ it("percentage_container_in_wrapping_container", function () { 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); @@ -1240,5 +1284,7 @@ it("percent_absolute_position", function () { 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 46e8b64d..b41b7585 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); @@ -79,11 +81,13 @@ it("rounding_flex_basis_flex_grow_row_width_of_100", function () { 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); @@ -178,11 +182,13 @@ it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { 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); @@ -250,11 +256,13 @@ it("rounding_flex_basis_flex_shrink_row", function () { 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); @@ -324,11 +332,13 @@ it("rounding_flex_basis_overrides_main_size", function () { 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); @@ -398,11 +408,13 @@ it("rounding_total_fractial", function () { 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); @@ -506,11 +518,13 @@ it("rounding_total_fractial_nested", function () { 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); @@ -580,11 +594,13 @@ it("rounding_fractial_input_1", function () { 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); @@ -654,11 +670,13 @@ it("rounding_fractial_input_2", function () { 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); @@ -729,11 +747,13 @@ it("rounding_fractial_input_3", function () { 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); @@ -804,6 +824,6 @@ it("rounding_fractial_input_4", function () { 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 603832f8..6818de0b 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); @@ -61,9 +63,13 @@ it("nested_overflowing_child", function () { 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); @@ -115,9 +121,13 @@ it("nested_overflowing_child_in_constraint_parent", function () { 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); @@ -168,5 +178,7 @@ it("parent_wrap_child_size_overflowing_parent", function () { if (typeof root !== "undefined") { root.freeRecursive(); } + + config.free(); } });