提交 3a4d3281 编写于 作者: B bayanxing

code check

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 ebdfc6aa
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
......
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'; import router from '@system.router';
import events_emitter from '@ohos.events.emitter'; import events_emitter from '@ohos.events.emitter';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
......
...@@ -68,15 +68,13 @@ describe('basicabilityapi', function () { ...@@ -68,15 +68,13 @@ describe('basicabilityapi', function () {
let promise1 = new Promise((resolve, reject) => { let promise1 = new Promise((resolve, reject) => {
intervalID = setInterval(function () { intervalID = setInterval(function () {
if(res === testTimes ){ if(res === testTimes ){
resolve(null);
clearInterval(intervalID); clearInterval(intervalID);
}else{ }
res++; res++;
console.info('testClearInterval res = ' + res); console.info('testClearInterval res = ' + res);
} resolve();
}, 100); }, 100);
}) });
Promise.all([promise1]).then(() => { Promise.all([promise1]).then(() => {
console.info('testClearInterval finally'); console.info('testClearInterval finally');
expect(testTimes).assertEqual(res); expect(testTimes).assertEqual(res);
...@@ -488,5 +486,38 @@ describe('basicabilityapi', function () { ...@@ -488,5 +486,38 @@ describe('basicabilityapi', function () {
done(); done();
}, 1000); }, 1000);
}); });
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_1500
* @tc.name testRequestAnimationFrame
* @tc.desc Sets a vsync after which a function will be executed.
*/
it('testRequestAnimationFrame', 0, async function (done) {
console.info('testRequestAnimationFrame START');
let requestId = requestAnimationFrame(function () {
console.info('testRequestAnimationFrame success');
expect(true).assertTrue();
done();
});
});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_1600
* @tc.name testCancelAnimationFrame
* @tc.desc Indicates the vsync callback ID returned by "requestAnimationFrame()".
*/
it('testCancelAnimationFrame', 0, async function (done) {
console.info('testCancelAnimationFrame START');
let result = true;
let requestId = requestAnimationFrame(function () {
console.info('testCancelAnimationFrame fail');
result = false;
});
cancelAnimationFrame(requestId);
await setTimeout(function () {
expect(result).assertTrue();
done();
}, 1000);
});
}); });
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册