Release 2.0.1Beta

This commit is contained in:
hyb1996
2017-03-19 16:21:07 +08:00
parent 85affed538
commit dd787236e7
110 changed files with 2428 additions and 4710 deletions

View File

@@ -1,8 +1,15 @@
package com.stardust.scriptdroid;
import com.stardust.scriptdroid.droid.script.JavaScriptEngine;
import com.stardust.scriptdroid.droid.script.RhinoJavaScriptEngine;
import com.stardust.scriptdroid.record.inputevent.InputEventToJsConverter;
import org.junit.Test;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel;
import java.lang.reflect.Array;
import java.util.Arrays;
/**
* Example local unit test, which will execute on the development machine (host).
@@ -10,16 +17,23 @@ import org.junit.Test;
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
// TODO: 2017/3/3 引擎兼容性
// TODO: 2017/3/3 更多的示例
// TODO: 2017/3/3 自定义函数
// TODO: 2017/3/3
// TODO: 2017/3/3 自定义函数
@Test
public void test() {
int i = 0xffffffff;
long l = i & 0xffffffffL;
System.out.println(l);
Context context = Context.enter();
context.setOptimizationLevel(-1);
context.setLanguageVersion(Context.VERSION_1_7);
context.setInstructionObserverThreshold(10000);
ImporterTopLevel importerTopLevel = new ImporterTopLevel();
importerTopLevel.initStandardObjects(context, false);
context.evaluateString(importerTopLevel, "var a = 1;var b = function(){};", "<init>", 1, null);
String[] ids = (String[]) importerTopLevel.getIds();
System.out.println(ids[0].getClass());
System.out.println(Arrays.toString(ids));
for(Object id : ids){
System.out.println(importerTopLevel.get(id));
}
}
}