提交 9514d935 编写于 作者: 杜庆泉's avatar 杜庆泉

uni-app x 增加lottie示例 & 更新语法测试示例

上级 8f162371
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
<button @tap="changeAction(1)">测试action play</button> <button @tap="changeAction(1)">测试action play</button>
<button @tap="changeAction(2)">测试action pause</button> <button @tap="changeAction(2)">测试action pause</button>
<button @tap="changeAction(3)">测试action stop</button> <button @tap="changeAction(3)">测试action stop</button>
<!-- <uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action" <uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
:hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest" :hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest"
:style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}"> :style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</uts-animation-view> --> </uts-animation-view>
</div> </div>
</template> </template>
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
</view> </view>
</template> </template>
<script lang="ts"> <script lang="ts">
// import { import {
// checkHasIntegration checkHasIntegration
// } from "@/uni_modules/uts-tencentgeolocation"; } from "@/uni_modules/uts-tencentgeolocation";
// import { import {
// checkHasLottieIntegration checkHasLottieIntegration
// } from "@/uni_modules/uts-animation-view"; } from "@/uni_modules/uts-animation-view";
type ListItem = { type ListItem = {
name : string, name : string,
...@@ -66,14 +66,29 @@ ...@@ -66,14 +66,29 @@
}) })
}, },
gotoLottie: function () { gotoLottie: function () {
if (checkHasLottieIntegration()) {
uni.navigateTo({
url: '/pages/SDKIntegration/Lottie/index'
})
} else {
uni.showToast({ uni.showToast({
title:'暂时不支持uni-appx' icon: 'none',
title: '需要在自定义基座中运行'
}) })
}
}, },
gotoTencentLocation: function () { gotoTencentLocation: function () {
let ret = checkHasIntegration();
if (!ret) {
uni.showToast({ uni.showToast({
title:'暂时不支持uni-appx' icon: 'none',
title: '需要在自定义基座中运行'
}) })
} else {
uni.navigateTo({
url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
})
}
}, },
gotoTencentMap: function () { gotoTencentMap: function () {
uni.navigateTo({ uni.navigateTo({
......
...@@ -173,38 +173,24 @@ ...@@ -173,38 +173,24 @@
this.testUtsSyncWithCallbackResult['return'] = false; this.testUtsSyncWithCallbackResult['return'] = false;
this.testUtsSyncWithCallbackResult['success'] = false; this.testUtsSyncWithCallbackResult['success'] = false;
this.testUtsSyncWithCallbackResult['complete'] = false; this.testUtsSyncWithCallbackResult['complete'] = false;
let option = new AsyncOptions(
"success", if (
(res:string) => { testSyncWithCallback({
type: "success",
success: (res:any) => {
console.log("testSyncWithCallback.success.callback", res); console.log("testSyncWithCallback.success.callback", res);
this.testUtsSyncWithCallbackResult['success'] = true; this.testUtsSyncWithCallbackResult['success'] = true;
}, },
(res:string) => { fail: (res:any) => {
console.log("testSyncWithCallback.fail.callback", res); console.log("testSyncWithCallback.fail.callback", res);
// testUtsSyncWithCallbackResult.fail = true; // testUtsSyncWithCallbackResult.fail = true;
}, },
(res:string) => { complete: (res:any) => {
console.log("testSyncWithCallback.complete.callback", res); console.log("testSyncWithCallback.complete.callback", res);
this.testUtsSyncWithCallbackResult['complete'] = true; this.testUtsSyncWithCallbackResult['complete'] = true;
}, },
) } as AsyncOptions)['name'] === "testSyncWithCallback"
if (
testSyncWithCallback(option)['name'] === "testSyncWithCallback"
// testSyncWithCallback({
// type: "success",
// success: (res:any) => {
// console.log("testSyncWithCallback.success.callback", res);
// this.testUtsSyncWithCallbackResult['success'] = true;
// },
// fail: (res:any) => {
// console.log("testSyncWithCallback.fail.callback", res);
// // testUtsSyncWithCallbackResult.fail = true;
// },
// complete: (res:any) => {
// console.log("testSyncWithCallback.complete.callback", res);
// this.testUtsSyncWithCallbackResult['complete'] = true;
// },
// }).name === "testSyncWithCallback"
) { ) {
this.testUtsSyncWithCallbackResult['return'] = true; this.testUtsSyncWithCallbackResult['return'] = true;
} }
...@@ -215,22 +201,22 @@ ...@@ -215,22 +201,22 @@
this.testUtsAsyncResult['success'] = false; this.testUtsAsyncResult['success'] = false;
// testUtsAsyncResult.fail = false; // testUtsAsyncResult.fail = false;
this.testUtsAsyncResult['complete'] = false; this.testUtsAsyncResult['complete'] = false;
let option = new AsyncOptions(
"success", try {
(res:any) => { const res = await testAsync({
type:"success",
success:(res:any) => {
console.log("testAsync.success.callback", res); console.log("testAsync.success.callback", res);
this.testUtsAsyncResult['success'] = true; this.testUtsAsyncResult['success'] = true;
}, },
(res:any) => { fail:(res:any) => {
console.log("testAsync.fail.callback", res); console.log("testAsync.fail.callback", res);
}, },
(res:any) => { complete:(res:any) => {
console.log("testAsync.complete.callback", res); console.log("testAsync.complete.callback", res);
this.testUtsAsyncResult['complete'] = true; this.testUtsAsyncResult['complete'] = true;
}, },
) } as AsyncOptions);
try {
const res = await testAsync(option);
if (res.name === "testAsync") { if (res.name === "testAsync") {
this.testUtsAsyncResult['return'] = true; this.testUtsAsyncResult['return'] = true;
} }
...@@ -242,22 +228,22 @@ ...@@ -242,22 +228,22 @@
this.testUtsAsyncMulitParamResult['return'] = false; this.testUtsAsyncMulitParamResult['return'] = false;
this.testUtsAsyncMulitParamResult['success'] = false; this.testUtsAsyncMulitParamResult['success'] = false;
this.testUtsAsyncMulitParamResult['complete'] = false; this.testUtsAsyncMulitParamResult['complete'] = false;
let option = AsyncOptions(
"success", try {
(res) => { const res = await testAsyncParam3(100,"hello",{
type:"success",
success:(res) => {
console.log("testUtsAsyncMulitParam.success.callback", res); console.log("testUtsAsyncMulitParam.success.callback", res);
this.testUtsAsyncMulitParamResult['success'] = true; this.testUtsAsyncMulitParamResult['success'] = true;
}, },
(res) => { fail:(res) => {
console.log("testUtsAsyncMulitParam.fail.callback", res); console.log("testUtsAsyncMulitParam.fail.callback", res);
}, },
(res) => { complete:(res) => {
console.log("testUtsAsyncMulitParam.complete.callback", res); console.log("testUtsAsyncMulitParam.complete.callback", res);
this.testUtsAsyncMulitParamResult['complete'] = true; this.testUtsAsyncMulitParamResult['complete'] = true;
}, },
) } as AsyncOptions);
try {
const res = await testAsyncParam3(100,"hello",option);
if (res.name === "testUtsAsyncMulitParam") { if (res.name === "testUtsAsyncMulitParam") {
this.testUtsAsyncMulitParamResult['return'] = true; this.testUtsAsyncMulitParamResult['return'] = true;
} }
...@@ -288,23 +274,21 @@ ...@@ -288,23 +274,21 @@
this.testUtsClassStaticSyncWithCallbackResult['return'] = false; this.testUtsClassStaticSyncWithCallbackResult['return'] = false;
this.testUtsClassStaticSyncWithCallbackResult['success'] = false; this.testUtsClassStaticSyncWithCallbackResult['success'] = false;
this.testUtsClassStaticSyncWithCallbackResult['complete'] = false; this.testUtsClassStaticSyncWithCallbackResult['complete'] = false;
let option = AsyncOptions( if (
"success", Test.testClassStaticSyncWithCallback({
(res) => { type:"success",
success:(res) => {
console.log("testStaticSyncWithCallback.success.callback", res); console.log("testStaticSyncWithCallback.success.callback", res);
this.testUtsClassStaticSyncWithCallbackResult['success'] = true; this.testUtsClassStaticSyncWithCallbackResult['success'] = true;
}, },
(res) => { fail:(res) => {
console.log("testStaticSyncWithCallback.fail.callback", res); console.log("testStaticSyncWithCallback.fail.callback", res);
// testUtsClassStaticSyncWithCallbackResult.fail = true;
}, },
(res) => { complete:(res) => {
console.log("testStaticSyncWithCallback.complete.callback", res); console.log("testStaticSyncWithCallback.complete.callback", res);
this.testUtsClassStaticSyncWithCallbackResult['complete'] = true; this.testUtsClassStaticSyncWithCallbackResult['complete'] = true;
}, },
) } as AsyncOptions)['name'] === "testSyncWithCallback"
if (
Test.testClassStaticSyncWithCallback(option)['name'] === "testSyncWithCallback"
) { ) {
this.testUtsClassStaticSyncWithCallbackResult['return'] = true; this.testUtsClassStaticSyncWithCallbackResult['return'] = true;
} }
...@@ -314,22 +298,22 @@ ...@@ -314,22 +298,22 @@
this.testUtsClassStaticAsyncResult['return'] = false; this.testUtsClassStaticAsyncResult['return'] = false;
this.testUtsClassStaticAsyncResult['success'] = false; this.testUtsClassStaticAsyncResult['success'] = false;
this.testUtsClassStaticAsyncResult['complete'] = false; this.testUtsClassStaticAsyncResult['complete'] = false;
let option = new AsyncOptions(
"success", try {
(res) => { const res = await Test.testClassStaticAsync({
type:"success",
success:(res:any) => {
console.log("testAsync.success.callback", res); console.log("testAsync.success.callback", res);
this.testUtsClassStaticAsyncResult['success'] = true; this.testUtsClassStaticAsyncResult['success'] = true;
}, },
(res) => { fail:(res:any) => {
console.log("testAsync.fail.callback", res); console.log("testAsync.fail.callback", res);
}, },
(res) => { complete:(res:any) => {
console.log("testAsync.complete.callback", res); console.log("testAsync.complete.callback", res);
this.testUtsClassStaticAsyncResult['complete'] = true; this.testUtsClassStaticAsyncResult['complete'] = true;
}, },
) } as AsyncOptions);
try {
const res = await Test.testClassStaticAsync(option);
if (res.name === "testAsync") { if (res.name === "testAsync") {
this.testUtsClassStaticAsyncResult['return'] = true; this.testUtsClassStaticAsyncResult['return'] = true;
} }
...@@ -383,23 +367,22 @@ ...@@ -383,23 +367,22 @@
this.testUtsClassAsyncResult['return'] = false; this.testUtsClassAsyncResult['return'] = false;
this.testUtsClassAsyncResult['success'] = false; this.testUtsClassAsyncResult['success'] = false;
this.testUtsClassAsyncResult['complete'] = false; this.testUtsClassAsyncResult['complete'] = false;
let option = AsyncOptions(
"success", try {
(res) => { const res = await test!.testClassAsync({
type:"success",
success:(res) => {
console.log("testAsync.success.callback", res); console.log("testAsync.success.callback", res);
this.testUtsClassAsyncResult['success'] = true; this.testUtsClassAsyncResult['success'] = true;
}, },
(res) => { fail:(res) => {
console.log("testAsync.fail.callback", res); console.log("testAsync.fail.callback", res);
}, },
(res) => { complete:(res) => {
console.log("testAsync.complete.callback", res); console.log("testAsync.complete.callback", res);
this.testUtsClassAsyncResult['complete'] = true; this.testUtsClassAsyncResult['complete'] = true;
}, },
) } as AsyncOptions);
try {
const res = await test!.testClassAsync(option);
console.log('res', res)
if (res.name === "testAsync") { if (res.name === "testAsync") {
this.testUtsClassAsyncResult['return'] = true; this.testUtsClassAsyncResult['return'] = true;
} }
...@@ -426,20 +409,19 @@ ...@@ -426,20 +409,19 @@
this.testUtsClassInstanceResult['callback'] = true; this.testUtsClassInstanceResult['callback'] = true;
} }
}) })
let option = SyncOptions(
(res) => { const res = task.sync({
success:(res) => {
console.log("task.sync.success.callback", res); console.log("task.sync.success.callback", res);
this.testUtsClassInstanceResult['success'] = true; this.testUtsClassInstanceResult['success'] = true;
}, },
(res) => { fail:(res) => {
console.log("task.sync.fail.callback", res); console.log("task.sync.fail.callback", res);
}, },
(res) => { complete:(res) => {
console.log("task.sync.complete.callback", res); console.log("task.sync.complete.callback", res);
this.testUtsClassInstanceResult['complete'] = true; this.testUtsClassInstanceResult['complete'] = true;
}, }} as SyncOptions)
)
const res = task.sync(option)
if (res === 'sync') { if (res === 'sync') {
this.testUtsClassInstanceResult['return'] = true; this.testUtsClassInstanceResult['return'] = true;
} }
......
...@@ -228,7 +228,7 @@ export function stopAssetAudio() { ...@@ -228,7 +228,7 @@ export function stopAssetAudio() {
} }
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
export function goOtherActivity(imageDone : (event : string) => void) : boolean { export function goOtherActivity(imageDone : (event : string) => void) : boolean {
// 检查相关权限是否已经具备 // 检查相关权限是否已经具备
......
...@@ -3,13 +3,13 @@ import AlertDialog from 'android.app.AlertDialog'; ...@@ -3,13 +3,13 @@ import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface'; import DialogInterface from 'android.content.DialogInterface';
import EditText from 'android.widget.EditText'; import EditText from 'android.widget.EditText';
@Suppress("UNUSED_PARAMETER") //@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function showAlert(_title : string | null, _message : string | null, _result : (index : Number) => void) { export function showAlert(_title : string | null, _message : string | null, _result : (index : Number) => void) {
let uiRunable = new DialogUIRunnable(null, _title!, _message!, "", false); let uiRunable = new DialogUIRunnable(null, _title!, _message!, "", false);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable) UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
} }
@Suppress("UNUSED_PARAMETER") //@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function showPrompt(_title : string | null, _message : string | null, _placeholder : string | null, success : (content : string) => void) { export function showPrompt(_title : string | null, _message : string | null, _placeholder : string | null, success : (content : string) => void) {
let uiRunable = new DialogUIRunnable(success, _title!, _message!, _placeholder!, true); let uiRunable = new DialogUIRunnable(success, _title!, _message!, _placeholder!, true);
UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable) UTSAndroid.getUniActivity()!.runOnUiThread(uiRunable)
......
...@@ -78,7 +78,7 @@ export class AppHookProxy implements UTSAndroidHookProxy { ...@@ -78,7 +78,7 @@ export class AppHookProxy implements UTSAndroidHookProxy {
} }
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
class ForeService extends Service { class ForeService extends Service {
constructor (){ constructor (){
...@@ -311,7 +311,7 @@ class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder>{ ...@@ -311,7 +311,7 @@ class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder>{
} }
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
class DemoActivity extends Activity{ class DemoActivity extends Activity{
constructor (){ constructor (){
...@@ -365,7 +365,7 @@ class DemoActivity extends Activity{ ...@@ -365,7 +365,7 @@ class DemoActivity extends Activity{
} }
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
class IntentRunable extends Runnable{ class IntentRunable extends Runnable{
override run(){ override run(){
console.log("IntentRunable = " + Thread.currentThread().getName()) console.log("IntentRunable = " + Thread.currentThread().getName())
...@@ -418,7 +418,7 @@ function initShortCut() { ...@@ -418,7 +418,7 @@ function initShortCut() {
} }
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
export function gotoDemoActivity():boolean { export function gotoDemoActivity():boolean {
// 这里的逻辑是为了判断 当前的自定义activity 是否注册了,并以此为条件判断是否是自定义基座 // 这里的逻辑是为了判断 当前的自定义activity 是否注册了,并以此为条件判断是否是自定义基座
let hasXActivityIntegration = true let hasXActivityIntegration = true
......
...@@ -168,7 +168,7 @@ export function gotoSystemPermissionActivityTest() { ...@@ -168,7 +168,7 @@ export function gotoSystemPermissionActivityTest() {
/** /**
* 跳转系统拍照界面,并触发相关生命周期测试 * 跳转系统拍照界面,并触发相关生命周期测试
*/ */
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
export function gotoCameraTake(imageDone : (event : string) => void) : boolean { export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
let permissionNeed = ["android.permission.CAMERA"] let permissionNeed = ["android.permission.CAMERA"]
......
...@@ -79,7 +79,7 @@ class ScreenFileObserver extends FileObserver { ...@@ -79,7 +79,7 @@ class ScreenFileObserver extends FileObserver {
/** /**
* 开启截图监听 * 开启截图监听
*/ */
@Suppress("DEPRECATION") //@UTSAndroid.Suppress("DEPRECATION")
export function onUserCaptureScreen(callback: UserCaptureScreenCallback) { export function onUserCaptureScreen(callback: UserCaptureScreenCallback) {
// 检查相关权限是否已经具备 // 检查相关权限是否已经具备
......
...@@ -187,7 +187,7 @@ export function getLocation(locationOptions: LocationOptions):boolean { ...@@ -187,7 +187,7 @@ export function getLocation(locationOptions: LocationOptions):boolean {
/** /**
* 持续监听位置变化 * 持续监听位置变化
*/ */
@Suppress("UNUSED_PARAMETER") //@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function watchPosition(_locationOptions: LocationOptions) { export function watchPosition(_locationOptions: LocationOptions) {
//todo //todo
} }
...@@ -195,7 +195,7 @@ export function watchPosition(_locationOptions: LocationOptions) { ...@@ -195,7 +195,7 @@ export function watchPosition(_locationOptions: LocationOptions) {
/** /**
* 关闭监听位置变化 * 关闭监听位置变化
*/ */
@Suppress("UNUSED_PARAMETER") //@UTSAndroid.Suppress("UNUSED_PARAMETER")
export function clearWatch() { export function clearWatch() {
//todo //todo
} }
\ No newline at end of file
import { describe, test, expect, Result } from './tests.uts' import { describe, test, expect, Result } from './tests.uts'
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS") //@UTSAndroid.Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
export function testForLoop(): Result { export function testForLoop(): Result {
return describe('ForLoop', () => { return describe('ForLoop', () => {
test('syntax', () => { test('syntax', () => {
......
import { describe, test, expect, Result } from './tests.uts' import { describe, test, expect, Result } from './tests.uts'
@Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS") //@UTSAndroid.Suppress("IMPLICIT_BOXING_IN_IDENTITY_EQUALS")
export function testNumber() : Result { export function testNumber() : Result {
return describe("Number", () => { return describe("Number", () => {
......
import { describe, test, expect, Result } from './tests.uts' import { describe, test, expect, Result } from './tests.uts'
@UTSAndroid.Suppress("USELESS_IS_CHECK") //@UTSAndroid.Suppress("USELESS_IS_CHECK")
export function testType() : Result { export function testType() : Result {
return describe("Type", () => { return describe("Type", () => {
test("Object literal to type instance", () => { test("Object literal to type instance", () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册