Use TestParametrization for testing both fbjni and vanillaJNI version

Summary: Use TestParametrization to test both fbjni and vanilla jni versions

Reviewed By: amir-shalem

Differential Revision: D17788718

fbshipit-source-id: 0f3317b7403cadca7b7ccd9140f1933d746bf433
This commit is contained in:
Sidharth Guglani
2019-10-09 09:26:47 -07:00
committed by Facebook Github Bot
parent d6591439d1
commit 293b657aef
3 changed files with 26 additions and 1 deletions

View File

@@ -38,5 +38,7 @@ public abstract class YogaConfig {
abstract long getNativePointer(); abstract long getNativePointer();
public abstract void setUseVanillaJNI(boolean useVanillaJNI);
public abstract boolean useVanillaJNI(); public abstract boolean useVanillaJNI();
} }

View File

@@ -99,6 +99,11 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
return mNativePointer; return mNativePointer;
} }
@Override
public void setUseVanillaJNI(boolean useVanillaJNI) {
this.useVanillaJNI = useVanillaJNI;
}
@Override @Override
public boolean useVanillaJNI() { public boolean useVanillaJNI() {
return this.useVanillaJNI; return this.useVanillaJNI;

View File

@@ -27,7 +27,25 @@ public class TestParametrization {
return "JNI"; return "JNI";
} }
}; };
return Arrays.asList(nodeFactory);
NodeFactory nodeFactoryUsingVanillaJNI = new NodeFactory() {
@Override
public YogaNode create() {
return YogaNodeFactory.create(true);
}
@Override
public YogaNode create(YogaConfig config) {
config.setUseVanillaJNI(true);
return YogaNodeFactory.create(config);
}
@Override
public String toString() {
return "VanillaJNI";
}
};
return Arrays.asList(nodeFactory, nodeFactoryUsingVanillaJNI);
} }