diff --git a/tests/js-tests/project/proj.android/src/org/cocos2dx/js_tests/AppActivity.java b/tests/js-tests/project/proj.android/src/org/cocos2dx/js_tests/AppActivity.java index 60946fb15e..259646d2bd 100644 --- a/tests/js-tests/project/proj.android/src/org/cocos2dx/js_tests/AppActivity.java +++ b/tests/js-tests/project/proj.android/src/org/cocos2dx/js_tests/AppActivity.java @@ -106,4 +106,9 @@ public class AppActivity extends Cocos2dxActivity { }); } + public static String getUtfStr() { + final String utf8Str = "you will see emotion:💝"; + return utf8Str; + } + } diff --git a/tests/js-tests/src/ReflectionTest/ReflectionTest.js b/tests/js-tests/src/ReflectionTest/ReflectionTest.js index c9cde09ec6..5e02babd18 100644 --- a/tests/js-tests/src/ReflectionTest/ReflectionTest.js +++ b/tests/js-tests/src/ReflectionTest/ReflectionTest.js @@ -52,7 +52,20 @@ var ReflectionTestLayer = BaseTestLayer.extend({ } }, this); - var menu = new cc.Menu(menuItem, menuItem2); + var label3 = new cc.LabelTTF("CallReflectionWithUTF8Str", "Arial", 35); + var menuItem3 = new cc.MenuItemLabel(label3, function(){ + if(cc.sys.os == cc.sys.OS_ANDROID){ + var ret = jsb.reflection.callStaticMethod("org/cocos2dx/js_tests/AppActivity", "getUtfStr", "()Ljava/lang/String;"); + jsb.reflection.callStaticMethod("org/cocos2dx/js_tests/AppActivity", "showAlertDialog", + "(Ljava/lang/String;Ljava/lang/String;)V", "Show Emotion", ret); + cc.log("result:" + ret); + }else if(cc.sys.os == cc.sys.OS_IOS || cc.sys.os == cc.sys.OS_OSX){ + var ret = "you will see emotion:💝"; + jsb.reflection.callStaticMethod("NativeOcClass","callNativeUIWithTitle:andContent:","Show Emotion", ret); + cc.log("result:" + ret); + } + }, this); + var menu = new cc.Menu(menuItem, menuItem2, menuItem3); menu.alignItemsVerticallyWithPadding(4); this.addChild(menu);