18c339a94Sopenharmony_ci/* 28c339a94Sopenharmony_ci* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. 38c339a94Sopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License"); 48c339a94Sopenharmony_ci* you may not use this file except in compliance with the License. 58c339a94Sopenharmony_ci* You may obtain a copy of the License at 68c339a94Sopenharmony_ci* 78c339a94Sopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0 88c339a94Sopenharmony_ci* 98c339a94Sopenharmony_ci* Unless required by applicable law or agreed to in writing, software 108c339a94Sopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS, 118c339a94Sopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128c339a94Sopenharmony_ci* See the License for the specific language governing permissions and 138c339a94Sopenharmony_ci* limitations under the License. 148c339a94Sopenharmony_ci*/ 158c339a94Sopenharmony_ciimport { AsyncCallback, Callback } from './../basic'; 168c339a94Sopenharmony_ci 178c339a94Sopenharmony_cideclare namespace napitest { 188c339a94Sopenharmony_ci class TestClass1 { 198c339a94Sopenharmony_ci fun11(cb: Callback<number>): void; 208c339a94Sopenharmony_ci fun12(cb: Callback<void>): void; 218c339a94Sopenharmony_ci fun13(cb: AsyncCallback<number>): void; 228c339a94Sopenharmony_ci fun14(cb: AsyncCallback<void>): void; 238c339a94Sopenharmony_ci fun15(cb: Callback<number>): string; 248c339a94Sopenharmony_ci fun16(tt: Function): void; 258c339a94Sopenharmony_ci fun17(tt: Function): string; 268c339a94Sopenharmony_ci 278c339a94Sopenharmony_ci // 针对不同返回值类型测试 288c339a94Sopenharmony_ci fun110(cb: (wid: boolean) => string): string; 298c339a94Sopenharmony_ci fun111(cb: (wid: boolean) => string): boolean; 308c339a94Sopenharmony_ci fun112(cb: (wid: boolean) => string): number; 318c339a94Sopenharmony_ci // fun113(cb: (wid: boolean) => string): TestClass2; // 待支持 328c339a94Sopenharmony_ci // fun114(cb: (wid: boolean) => string): Human; // 待支持 338c339a94Sopenharmony_ci 348c339a94Sopenharmony_ci // 针对回调返回值类型测试 358c339a94Sopenharmony_ci fun210(cb: (wid: boolean) => string): boolean; 368c339a94Sopenharmony_ci fun211(cb: (wid: boolean) => boolean): string; 378c339a94Sopenharmony_ci fun212(cb: (wid: boolean) => number): string; 388c339a94Sopenharmony_ci // fun213(cb: (wid: boolean) => TestClass2): string; 398c339a94Sopenharmony_ci // fun214(cb: (wid: boolean) => Human): string; 408c339a94Sopenharmony_ci } 418c339a94Sopenharmony_ci 428c339a94Sopenharmony_ci interface TestClass2 { 438c339a94Sopenharmony_ci str: string; 448c339a94Sopenharmony_ci 458c339a94Sopenharmony_ci } 468c339a94Sopenharmony_ci 478c339a94Sopenharmony_ci export class Human { 488c339a94Sopenharmony_ci name: string; 498c339a94Sopenharmony_ci age: number; 508c339a94Sopenharmony_ci } 518c339a94Sopenharmony_ci 528c339a94Sopenharmony_ci function fun1(cb: Callback<number>): void; 538c339a94Sopenharmony_ci function fun2(cb: Callback<void>): void; 548c339a94Sopenharmony_ci function fun3(cb: AsyncCallback<number>): void; 558c339a94Sopenharmony_ci function fun4(cb: AsyncCallback<void>): void; 568c339a94Sopenharmony_ci function fun5(cb: Callback<number>): string; // to add testcase for return type is not void 578c339a94Sopenharmony_ci function fun6(tt: Function): void; 588c339a94Sopenharmony_ci function fun7(tt: Function): string; 598c339a94Sopenharmony_ci 608c339a94Sopenharmony_ci // 以下测试用例待增加测试用例 begin 618c339a94Sopenharmony_ci function fun8(cb: (wid: boolean) => void): string; 628c339a94Sopenharmony_ci 638c339a94Sopenharmony_ci // 针对不同返回值类型测试 648c339a94Sopenharmony_ci function fun10nm(cb: (wid: boolean) => string): string; 658c339a94Sopenharmony_ci function fun11nm(cb: (wid: boolean) => string): boolean; 668c339a94Sopenharmony_ci function fun12nm(cb: (wid: boolean) => string): number; 678c339a94Sopenharmony_ci // function fun13nm(cb: (wid: boolean) => string): TestClass2; // 待支持 688c339a94Sopenharmony_ci // function fun14nm(cb: (wid: boolean) => string): Human; // 待支持 698c339a94Sopenharmony_ci 708c339a94Sopenharmony_ci // 针对回调返回值类型测试 718c339a94Sopenharmony_ci function fun20nm(cb: (wid: boolean) => string): boolean; 728c339a94Sopenharmony_ci function fun21nm(cb: (wid: boolean) => boolean): string; 738c339a94Sopenharmony_ci function fun22nm(cb: (wid: boolean) => number): string; 748c339a94Sopenharmony_ci // function fun23nm(cb: (wid: boolean) => TestClass2): string; // 待支持 758c339a94Sopenharmony_ci // function fun24nm(cb: (wid: boolean) => Human): string; // 待支持 768c339a94Sopenharmony_ci 778c339a94Sopenharmony_ci // // 以下测试用例待支持 788c339a94Sopenharmony_ci 798c339a94Sopenharmony_ci function fun9(cb: (wid: boolean, str: string, tc2:number) => string): string; 808c339a94Sopenharmony_ci 818c339a94Sopenharmony_ci // function fun9(cb: (wid: boolean, str: string, tc2:TestClass2) => string): string; // 回调函数参数个数大于1,待支持 828c339a94Sopenharmony_ci} 838c339a94Sopenharmony_ci 848c339a94Sopenharmony_ciexport default napitest; 85