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
This commit is contained in:
Maël Nison
2017-03-28 10:28:53 -07:00
committed by Facebook Github Bot
parent 91a34bb875
commit 36f6fa9861
28 changed files with 928 additions and 117 deletions

View File

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

View File

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

View File

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