1bc03f14fSopenharmony_ci/*
2bc03f14fSopenharmony_ci * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
3bc03f14fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the 'License');
4bc03f14fSopenharmony_ci * you may not use this file except in compliance with the License.
5bc03f14fSopenharmony_ci * You may obtain a copy of the License at
6bc03f14fSopenharmony_ci *
7bc03f14fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8bc03f14fSopenharmony_ci *
9bc03f14fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10bc03f14fSopenharmony_ci * distributed under the License is distributed on an 'AS IS' BASIS,
11bc03f14fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12bc03f14fSopenharmony_ci * See the License for the specific language governing permissions and
13bc03f14fSopenharmony_ci * limitations under the License.
14bc03f14fSopenharmony_ci */
15bc03f14fSopenharmony_ci// @ts-nocheck
16bc03f14fSopenharmony_ciimport { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
17bc03f14fSopenharmony_ciimport pasteboard from '@ohos.pasteboard';
18bc03f14fSopenharmony_ciimport image from '@ohos.multimedia.image';
19bc03f14fSopenharmony_ci
20bc03f14fSopenharmony_cidescribe('PasteBoardJSTest', function () {
21bc03f14fSopenharmony_ci  beforeAll(async function () {
22bc03f14fSopenharmony_ci    console.info('beforeAll');
23bc03f14fSopenharmony_ci  });
24bc03f14fSopenharmony_ci
25bc03f14fSopenharmony_ci  afterAll(async function () {
26bc03f14fSopenharmony_ci    console.info('afterAll');
27bc03f14fSopenharmony_ci  });
28bc03f14fSopenharmony_ci
29bc03f14fSopenharmony_ci  /**
30bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test1
31bc03f14fSopenharmony_ci   * @tc.desc      Adds PlainTextData
32bc03f14fSopenharmony_ci   * @tc.type      Function
33bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
34bc03f14fSopenharmony_ci   */
35bc03f14fSopenharmony_ci  it('pasteboard_promise_test1', 0, async function (done) {
36bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
37bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
38bc03f14fSopenharmony_ci    const textData1 = 'Hello World!';
39bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData1);
40bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
41bc03f14fSopenharmony_ci    const res = await systemPasteboard.hasPasteData();
42bc03f14fSopenharmony_ci    expect(res).assertEqual(true);
43bc03f14fSopenharmony_ci    const types = pasteData.getMimeTypes();
44bc03f14fSopenharmony_ci    expect('text/plain').assertEqual(types[0]);
45bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
46bc03f14fSopenharmony_ci      const pasteData1 = data;
47bc03f14fSopenharmony_ci      expect(pasteData1.getRecordCount()).assertEqual(1);
48bc03f14fSopenharmony_ci      const primaryText = pasteData1.getPrimaryText();
49bc03f14fSopenharmony_ci      expect(primaryText).assertEqual(textData1);
50bc03f14fSopenharmony_ci      expect(pasteboard.MAX_RECORD_NUM).assertEqual(512);
51bc03f14fSopenharmony_ci      expect(pasteData1.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
52bc03f14fSopenharmony_ci      done();
53bc03f14fSopenharmony_ci    });
54bc03f14fSopenharmony_ci  });
55bc03f14fSopenharmony_ci
56bc03f14fSopenharmony_ci  /**
57bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test2
58bc03f14fSopenharmony_ci   * @tc.desc      Adds PlainTextData = ''
59bc03f14fSopenharmony_ci   * @tc.type      Function
60bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
61bc03f14fSopenharmony_ci   */
62bc03f14fSopenharmony_ci  it('pasteboard_promise_test2', 0, async function (done) {
63bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
64bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
65bc03f14fSopenharmony_ci    const textData2 = '';
66bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData2);
67bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
68bc03f14fSopenharmony_ci    const res2 = await systemPasteboard.hasPasteData();
69bc03f14fSopenharmony_ci    expect(res2).assertEqual(true);
70bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
71bc03f14fSopenharmony_ci      const recordCount2 = data.getRecordCount();
72bc03f14fSopenharmony_ci      expect(recordCount2).assertEqual(1);
73bc03f14fSopenharmony_ci      done();
74bc03f14fSopenharmony_ci    });
75bc03f14fSopenharmony_ci  });
76bc03f14fSopenharmony_ci
77bc03f14fSopenharmony_ci  /**
78bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test3
79bc03f14fSopenharmony_ci   * @tc.desc      Adds PlainTextData = 'Hello 中国!@#$%^&*()_+{}\?.'
80bc03f14fSopenharmony_ci   * @tc.type      Function
81bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
82bc03f14fSopenharmony_ci   */
83bc03f14fSopenharmony_ci  it('pasteboard_promise_test3', 0, async function (done) {
84bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
85bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
86bc03f14fSopenharmony_ci    const textData3 = 'Hello 中国!@#$%^&*()_+{}?.';
87bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData3);
88bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
89bc03f14fSopenharmony_ci    const res3 = await systemPasteboard.hasPasteData();
90bc03f14fSopenharmony_ci    expect(res3).assertEqual(true);
91bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
92bc03f14fSopenharmony_ci      const pasteData3 = data;
93bc03f14fSopenharmony_ci      expect(pasteData3.getRecordCount()).assertEqual(1);
94bc03f14fSopenharmony_ci      const primaryText = pasteData3.getPrimaryText();
95bc03f14fSopenharmony_ci      expect(primaryText).assertEqual(textData3);
96bc03f14fSopenharmony_ci      expect(pasteData3.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
97bc03f14fSopenharmony_ci      done();
98bc03f14fSopenharmony_ci    });
99bc03f14fSopenharmony_ci  });
100bc03f14fSopenharmony_ci
101bc03f14fSopenharmony_ci  /**
102bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test4
103bc03f14fSopenharmony_ci   * @tc.desc      Adds 300K PlainTextData
104bc03f14fSopenharmony_ci   * @tc.type      Function
105bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
106bc03f14fSopenharmony_ci   */
107bc03f14fSopenharmony_ci  it('pasteboard_promise_test4', 0, async function (done) {
108bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
109bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
110bc03f14fSopenharmony_ci    let textData4 = '';
111bc03f14fSopenharmony_ci    for (let i = 0; i < 300; i++) {
112bc03f14fSopenharmony_ci      textData4 = textData4 + 'A';
113bc03f14fSopenharmony_ci    }
114bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData4);
115bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
116bc03f14fSopenharmony_ci    const res4 = await systemPasteboard.hasPasteData();
117bc03f14fSopenharmony_ci    expect(res4).assertEqual(true);
118bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
119bc03f14fSopenharmony_ci      const pasteData4 = data;
120bc03f14fSopenharmony_ci      expect(pasteData4.getRecordCount()).assertEqual(1);
121bc03f14fSopenharmony_ci      const primaryText = pasteData4.getPrimaryText();
122bc03f14fSopenharmony_ci      expect(primaryText).assertEqual(textData4);
123bc03f14fSopenharmony_ci      expect(pasteData4.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
124bc03f14fSopenharmony_ci      expect(pasteData4.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN);
125bc03f14fSopenharmony_ci      done();
126bc03f14fSopenharmony_ci    });
127bc03f14fSopenharmony_ci  });
128bc03f14fSopenharmony_ci
129bc03f14fSopenharmony_ci  /**
130bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test5
131bc03f14fSopenharmony_ci   * @tc.desc      Adds htmlText
132bc03f14fSopenharmony_ci   * @tc.type      Function
133bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
134bc03f14fSopenharmony_ci   */
135bc03f14fSopenharmony_ci  it('pasteboard_promise_test5', 0, async function (done) {
136bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
137bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
138bc03f14fSopenharmony_ci    const htmlText5 = '<html><head></head><body>Hello World!</body></html>';
139bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText5);
140bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
141bc03f14fSopenharmony_ci    const res5 = await systemPasteboard.hasPasteData();
142bc03f14fSopenharmony_ci    expect(res5).assertEqual(true);
143bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
144bc03f14fSopenharmony_ci      const pasteData5 = data;
145bc03f14fSopenharmony_ci      expect(pasteData5.getRecordCount()).assertEqual(1);
146bc03f14fSopenharmony_ci      const primaryHtml6 = pasteData5.getPrimaryHtml();
147bc03f14fSopenharmony_ci      expect(primaryHtml6).assertEqual(htmlText5);
148bc03f14fSopenharmony_ci      expect(pasteData5.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
149bc03f14fSopenharmony_ci      expect(pasteData5.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
150bc03f14fSopenharmony_ci      done();
151bc03f14fSopenharmony_ci    });
152bc03f14fSopenharmony_ci  });
153bc03f14fSopenharmony_ci
154bc03f14fSopenharmony_ci  /**
155bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test6
156bc03f14fSopenharmony_ci   * @tc.desc      Adds htmlText = ''
157bc03f14fSopenharmony_ci   * @tc.type      Function
158bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
159bc03f14fSopenharmony_ci   */
160bc03f14fSopenharmony_ci  it('pasteboard_promise_test6', 0, async function (done) {
161bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
162bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
163bc03f14fSopenharmony_ci    const htmlText6 = '';
164bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText6);
165bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
166bc03f14fSopenharmony_ci    const res6 = await systemPasteboard.hasPasteData();
167bc03f14fSopenharmony_ci    expect(res6).assertEqual(true);
168bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
169bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
170bc03f14fSopenharmony_ci      const primaryHtml6 = data.getPrimaryHtml();
171bc03f14fSopenharmony_ci      expect(primaryHtml6).assertEqual(htmlText6);
172bc03f14fSopenharmony_ci      expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
173bc03f14fSopenharmony_ci      expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
174bc03f14fSopenharmony_ci      done();
175bc03f14fSopenharmony_ci    });
176bc03f14fSopenharmony_ci  });
177bc03f14fSopenharmony_ci
178bc03f14fSopenharmony_ci  /**
179bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test7
180bc03f14fSopenharmony_ci   * @tc.desc      Adds htmlText = 'Hello 中国!@#$%^&*()_+{}\?.'
181bc03f14fSopenharmony_ci   * @tc.type      Function
182bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
183bc03f14fSopenharmony_ci   */
184bc03f14fSopenharmony_ci  it('pasteboard_promise_test7', 0, async function (done) {
185bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
186bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
187bc03f14fSopenharmony_ci    const htmlText = 'Hello 中国!@#$%^&*()_+{}?.';
188bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText);
189bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
190bc03f14fSopenharmony_ci    const res = await systemPasteboard.hasPasteData();
191bc03f14fSopenharmony_ci    expect(res).assertEqual(true);
192bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
193bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
194bc03f14fSopenharmony_ci      expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
195bc03f14fSopenharmony_ci      expect(data.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
196bc03f14fSopenharmony_ci      expect(data.getPrimaryHtml()).assertEqual(htmlText);
197bc03f14fSopenharmony_ci      done();
198bc03f14fSopenharmony_ci    });
199bc03f14fSopenharmony_ci  });
200bc03f14fSopenharmony_ci
201bc03f14fSopenharmony_ci  /**
202bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test8
203bc03f14fSopenharmony_ci   * @tc.desc      Adds uriText
204bc03f14fSopenharmony_ci   * @tc.type      Function
205bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
206bc03f14fSopenharmony_ci   */
207bc03f14fSopenharmony_ci  it('pasteboard_promise_test8', 0, async function (done) {
208bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
209bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
210bc03f14fSopenharmony_ci    const uriText8 = 'https://www.baidu.com/';
211bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText8);
212bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
213bc03f14fSopenharmony_ci    const res8 = await systemPasteboard.hasPasteData();
214bc03f14fSopenharmony_ci    expect(res8).assertEqual(true);
215bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
216bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
217bc03f14fSopenharmony_ci      const primaryUri8 = data.getPrimaryUri();
218bc03f14fSopenharmony_ci      expect(primaryUri8).assertEqual(uriText8);
219bc03f14fSopenharmony_ci      expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true);
220bc03f14fSopenharmony_ci      done();
221bc03f14fSopenharmony_ci    });
222bc03f14fSopenharmony_ci  });
223bc03f14fSopenharmony_ci
224bc03f14fSopenharmony_ci  /**
225bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test9
226bc03f14fSopenharmony_ci   * @tc.desc      Adds uriText = ''
227bc03f14fSopenharmony_ci   * @tc.type      Function
228bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
229bc03f14fSopenharmony_ci   */
230bc03f14fSopenharmony_ci  it('pasteboard_promise_test9', 0, async function (done) {
231bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
232bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
233bc03f14fSopenharmony_ci    const uriText9 = '';
234bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText9);
235bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
236bc03f14fSopenharmony_ci    const res9 = await systemPasteboard.hasPasteData();
237bc03f14fSopenharmony_ci    expect(res9).assertEqual(true);
238bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
239bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
240bc03f14fSopenharmony_ci      expect(data.getPrimaryUri()).assertEqual(uriText9);
241bc03f14fSopenharmony_ci      done();
242bc03f14fSopenharmony_ci    });
243bc03f14fSopenharmony_ci  });
244bc03f14fSopenharmony_ci
245bc03f14fSopenharmony_ci  /**
246bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test10
247bc03f14fSopenharmony_ci   * @tc.desc      Set uriText = 'Hello //'
248bc03f14fSopenharmony_ci   * @tc.type      Function
249bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
250bc03f14fSopenharmony_ci   */
251bc03f14fSopenharmony_ci  it('pasteboard_promise_test10', 0, async function (done) {
252bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
253bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
254bc03f14fSopenharmony_ci    const uriText10 = 'Hello//';
255bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText10);
256bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
257bc03f14fSopenharmony_ci    const res10 = await systemPasteboard.hasPasteData();
258bc03f14fSopenharmony_ci    expect(res10).assertEqual(true);
259bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
260bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
261bc03f14fSopenharmony_ci      expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true);
262bc03f14fSopenharmony_ci      expect(data.getPrimaryUri()).assertEqual(uriText10);
263bc03f14fSopenharmony_ci      done();
264bc03f14fSopenharmony_ci    });
265bc03f14fSopenharmony_ci  });
266bc03f14fSopenharmony_ci
267bc03f14fSopenharmony_ci  /**
268bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test11
269bc03f14fSopenharmony_ci   * @tc.desc      Adds want
270bc03f14fSopenharmony_ci   * @tc.type      Function
271bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
272bc03f14fSopenharmony_ci   */
273bc03f14fSopenharmony_ci  it('pasteboard_promise_test11', 0, async function (done) {
274bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
275bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
276bc03f14fSopenharmony_ci    const want11 = {
277bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication8',
278bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication8.MainAbility',
279bc03f14fSopenharmony_ci    };
280bc03f14fSopenharmony_ci    const pasteData = pasteboard.createWantData(want11);
281bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
282bc03f14fSopenharmony_ci    const res11 = await systemPasteboard.hasPasteData();
283bc03f14fSopenharmony_ci    expect(res11).assertEqual(true);
284bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
285bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
286bc03f14fSopenharmony_ci      const primaryWant = data.getPrimaryWant();
287bc03f14fSopenharmony_ci      expect(want11.bundleName).assertEqual(primaryWant.bundleName);
288bc03f14fSopenharmony_ci      expect(want11.abilityName).assertEqual(primaryWant.abilityName);
289bc03f14fSopenharmony_ci      expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT)).assertEqual(true);
290bc03f14fSopenharmony_ci      done();
291bc03f14fSopenharmony_ci    });
292bc03f14fSopenharmony_ci  });
293bc03f14fSopenharmony_ci
294bc03f14fSopenharmony_ci  /**
295bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test12
296bc03f14fSopenharmony_ci   * @tc.desc      Adds one record(s)
297bc03f14fSopenharmony_ci   * @tc.type      Function
298bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
299bc03f14fSopenharmony_ci   */
300bc03f14fSopenharmony_ci  it('pasteboard_promise_test12', 0, async function (done) {
301bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
302bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
303bc03f14fSopenharmony_ci    const textData12 = 'Hello World!';
304bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData12);
305bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
306bc03f14fSopenharmony_ci    const res12 = await systemPasteboard.hasPasteData();
307bc03f14fSopenharmony_ci    expect(res12).assertEqual(true);
308bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
309bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
310bc03f14fSopenharmony_ci      let recordText12 = data.getRecordAt(0).plainText;
311bc03f14fSopenharmony_ci      expect(recordText12).assertEqual(textData12);
312bc03f14fSopenharmony_ci      done();
313bc03f14fSopenharmony_ci    });
314bc03f14fSopenharmony_ci  });
315bc03f14fSopenharmony_ci
316bc03f14fSopenharmony_ci  /**
317bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test13
318bc03f14fSopenharmony_ci   * @tc.desc      Adds 2 record(s)
319bc03f14fSopenharmony_ci   * @tc.type      Function
320bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
321bc03f14fSopenharmony_ci   */
322bc03f14fSopenharmony_ci  it('pasteboard_promise_test13', 0, async function (done) {
323bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
324bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
325bc03f14fSopenharmony_ci    const textData130 = 'Hello World!';
326bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData130);
327bc03f14fSopenharmony_ci    const textData131 = 'Hello World1';
328bc03f14fSopenharmony_ci    pasteData.addTextRecord(textData131);
329bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
330bc03f14fSopenharmony_ci    const res13 = await systemPasteboard.hasPasteData();
331bc03f14fSopenharmony_ci    expect(res13).assertEqual(true);
332bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
333bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(2);
334bc03f14fSopenharmony_ci      const dataRecord130 = data.getRecordAt(0);
335bc03f14fSopenharmony_ci      const dataRecord131 = data.getRecordAt(1);
336bc03f14fSopenharmony_ci      expect(dataRecord130.plainText).assertEqual(textData131);
337bc03f14fSopenharmony_ci      expect(dataRecord131.plainText).assertEqual(textData130);
338bc03f14fSopenharmony_ci      done();
339bc03f14fSopenharmony_ci    });
340bc03f14fSopenharmony_ci  });
341bc03f14fSopenharmony_ci
342bc03f14fSopenharmony_ci  /**
343bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test14
344bc03f14fSopenharmony_ci   * @tc.desc      Adds 15 record(s)
345bc03f14fSopenharmony_ci   * @tc.type      Function
346bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
347bc03f14fSopenharmony_ci   */
348bc03f14fSopenharmony_ci  it('pasteboard_promise_test14', 0, async function (done) {
349bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
350bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
351bc03f14fSopenharmony_ci    const textData140 = 'Hello World!';
352bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData140);
353bc03f14fSopenharmony_ci    let textData14 = '';
354bc03f14fSopenharmony_ci    for (let i = 1; i < 15; i++) {
355bc03f14fSopenharmony_ci      textData14 = 'Hello World';
356bc03f14fSopenharmony_ci      textData14 = textData14 + i;
357bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData14);
358bc03f14fSopenharmony_ci    }
359bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
360bc03f14fSopenharmony_ci    const res14 = await systemPasteboard.hasPasteData();
361bc03f14fSopenharmony_ci    expect(res14).assertEqual(true);
362bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
363bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(15);
364bc03f14fSopenharmony_ci      const dataRecord14 = data.getRecordAt(14);
365bc03f14fSopenharmony_ci      expect(dataRecord14.plainText).assertEqual(textData140);
366bc03f14fSopenharmony_ci      done();
367bc03f14fSopenharmony_ci    });
368bc03f14fSopenharmony_ci  });
369bc03f14fSopenharmony_ci
370bc03f14fSopenharmony_ci  /**
371bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test15
372bc03f14fSopenharmony_ci   * @tc.desc      Adds 30 record(s)
373bc03f14fSopenharmony_ci   * @tc.type      Function
374bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
375bc03f14fSopenharmony_ci   */
376bc03f14fSopenharmony_ci  it('pasteboard_promise_test15', 0, async function (done) {
377bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
378bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
379bc03f14fSopenharmony_ci    const textData150 = 'Hello World!';
380bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData150);
381bc03f14fSopenharmony_ci    let textData15 = '';
382bc03f14fSopenharmony_ci    for (let i = 1; i < 30; i++) {
383bc03f14fSopenharmony_ci      textData15 = 'Hello World';
384bc03f14fSopenharmony_ci      textData15 = textData15 + i;
385bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData15);
386bc03f14fSopenharmony_ci    }
387bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
388bc03f14fSopenharmony_ci    const res15 = await systemPasteboard.hasPasteData();
389bc03f14fSopenharmony_ci    expect(res15).assertEqual(true);
390bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
391bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(30);
392bc03f14fSopenharmony_ci      const dataRecord15 = data.getRecordAt(0);
393bc03f14fSopenharmony_ci      expect(dataRecord15.plainText).assertEqual('Hello World29');
394bc03f14fSopenharmony_ci      done();
395bc03f14fSopenharmony_ci    });
396bc03f14fSopenharmony_ci  });
397bc03f14fSopenharmony_ci
398bc03f14fSopenharmony_ci  /**
399bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test16
400bc03f14fSopenharmony_ci   * @tc.desc      Adds 31 record(s)
401bc03f14fSopenharmony_ci   * @tc.type      Function
402bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
403bc03f14fSopenharmony_ci   */
404bc03f14fSopenharmony_ci  it('pasteboard_promise_test16', 0, async function (done) {
405bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
406bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
407bc03f14fSopenharmony_ci    const textData160 = 'Hello World!';
408bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData160);
409bc03f14fSopenharmony_ci    let textData16 = '';
410bc03f14fSopenharmony_ci    for (let i = 1; i < 31; i++) {
411bc03f14fSopenharmony_ci      textData16 = 'Hello World';
412bc03f14fSopenharmony_ci      textData16 = textData16 + i;
413bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData16);
414bc03f14fSopenharmony_ci    }
415bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
416bc03f14fSopenharmony_ci    const res16 = await systemPasteboard.hasPasteData();
417bc03f14fSopenharmony_ci    expect(res16).assertEqual(true);
418bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
419bc03f14fSopenharmony_ci      const recordCount16 = data.getRecordCount();
420bc03f14fSopenharmony_ci      expect(recordCount16).assertEqual(31);
421bc03f14fSopenharmony_ci      const dataRecord16 = data.getRecordAt(0);
422bc03f14fSopenharmony_ci      expect(dataRecord16.plainText).assertEqual('Hello World30');
423bc03f14fSopenharmony_ci      done();
424bc03f14fSopenharmony_ci    });
425bc03f14fSopenharmony_ci  });
426bc03f14fSopenharmony_ci
427bc03f14fSopenharmony_ci  /**
428bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test17
429bc03f14fSopenharmony_ci   * @tc.desc      Adds PlainText,HtmlText,UriText
430bc03f14fSopenharmony_ci   * @tc.type      Function
431bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
432bc03f14fSopenharmony_ci   */
433bc03f14fSopenharmony_ci  it('pasteboard_promise_test17', 0, async function (done) {
434bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
435bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
436bc03f14fSopenharmony_ci    const textData17 = 'Hello World!';
437bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData17);
438bc03f14fSopenharmony_ci    const htmlText17 = '<html><head></head><body>Hello World!</body></html>';
439bc03f14fSopenharmony_ci    pasteData.addHtmlRecord(htmlText17);
440bc03f14fSopenharmony_ci    const uriText17 = 'https://www.baidu.com/';
441bc03f14fSopenharmony_ci    pasteData.addUriRecord(uriText17);
442bc03f14fSopenharmony_ci    const want17 = {
443bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication8',
444bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication8.MainAbility',
445bc03f14fSopenharmony_ci    };
446bc03f14fSopenharmony_ci    pasteData.addWantRecord(want17);
447bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
448bc03f14fSopenharmony_ci    const res17 = await systemPasteboard.hasPasteData();
449bc03f14fSopenharmony_ci    expect(res17).assertEqual(true);
450bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
451bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(4);
452bc03f14fSopenharmony_ci      const wantRecord17 = data.getPrimaryWant();
453bc03f14fSopenharmony_ci      expect(wantRecord17.bundleName).assertEqual(want17.bundleName);
454bc03f14fSopenharmony_ci      expect(wantRecord17.abilityName).assertEqual(want17.abilityName);
455bc03f14fSopenharmony_ci      done();
456bc03f14fSopenharmony_ci    });
457bc03f14fSopenharmony_ci  });
458bc03f14fSopenharmony_ci
459bc03f14fSopenharmony_ci  /**
460bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test18
461bc03f14fSopenharmony_ci   * @tc.desc      Delete one PlainTextData
462bc03f14fSopenharmony_ci   * @tc.type      Function
463bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
464bc03f14fSopenharmony_ci   */
465bc03f14fSopenharmony_ci  it('pasteboard_promise_test18', 0, async function (done) {
466bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
467bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
468bc03f14fSopenharmony_ci    const textData18 = 'Hello World!';
469bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData18);
470bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
471bc03f14fSopenharmony_ci    const res18 = await systemPasteboard.hasPasteData();
472bc03f14fSopenharmony_ci    expect(res18).assertEqual(true);
473bc03f14fSopenharmony_ci    const pasteData18 = await systemPasteboard.getPasteData();
474bc03f14fSopenharmony_ci    expect(pasteData18.getRecordCount()).assertEqual(1);
475bc03f14fSopenharmony_ci    expect(pasteData18.removeRecordAt(0)).assertEqual(true);
476bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData18);
477bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
478bc03f14fSopenharmony_ci      const recordCount18 = data.getRecordCount();
479bc03f14fSopenharmony_ci      expect(recordCount18).assertEqual(0);
480bc03f14fSopenharmony_ci      done();
481bc03f14fSopenharmony_ci    });
482bc03f14fSopenharmony_ci  });
483bc03f14fSopenharmony_ci
484bc03f14fSopenharmony_ci  /**
485bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test19
486bc03f14fSopenharmony_ci   * @tc.desc      Delete one htmlText
487bc03f14fSopenharmony_ci   * @tc.type      Function
488bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
489bc03f14fSopenharmony_ci   */
490bc03f14fSopenharmony_ci  it('pasteboard_promise_test19', 0, async function (done) {
491bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
492bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
493bc03f14fSopenharmony_ci    const htmlText19 = '<html><head></head><body>Hello World!</body></html>';
494bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText19);
495bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
496bc03f14fSopenharmony_ci    const res19 = await systemPasteboard.hasPasteData();
497bc03f14fSopenharmony_ci    expect(res19).assertEqual(true);
498bc03f14fSopenharmony_ci    const pasteData19 = await systemPasteboard.getPasteData();
499bc03f14fSopenharmony_ci    expect(pasteData19.getRecordCount()).assertEqual(1);
500bc03f14fSopenharmony_ci    expect(pasteData19.removeRecordAt(0)).assertEqual(true);
501bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData19);
502bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
503bc03f14fSopenharmony_ci      const recordCount19 = data.getRecordCount();
504bc03f14fSopenharmony_ci      expect(recordCount19).assertEqual(0);
505bc03f14fSopenharmony_ci      done();
506bc03f14fSopenharmony_ci    });
507bc03f14fSopenharmony_ci  });
508bc03f14fSopenharmony_ci
509bc03f14fSopenharmony_ci  /**
510bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test20
511bc03f14fSopenharmony_ci   * @tc.desc      Delete one uriText
512bc03f14fSopenharmony_ci   * @tc.type      Function
513bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
514bc03f14fSopenharmony_ci   */
515bc03f14fSopenharmony_ci  it('pasteboard_promise_test20', 0, async function (done) {
516bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
517bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
518bc03f14fSopenharmony_ci    const uriText20 = 'https://www.baidu.com/';
519bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText20);
520bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
521bc03f14fSopenharmony_ci    const res20 = await systemPasteboard.hasPasteData();
522bc03f14fSopenharmony_ci    expect(res20).assertEqual(true);
523bc03f14fSopenharmony_ci    const pasteData20 = await systemPasteboard.getPasteData();
524bc03f14fSopenharmony_ci    expect(pasteData20.getRecordCount()).assertEqual(1);
525bc03f14fSopenharmony_ci    expect(pasteData20.removeRecordAt(0)).assertEqual(true);
526bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData20);
527bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
528bc03f14fSopenharmony_ci      const recordCount20 = data.getRecordCount();
529bc03f14fSopenharmony_ci      expect(recordCount20).assertEqual(0);
530bc03f14fSopenharmony_ci      done();
531bc03f14fSopenharmony_ci    });
532bc03f14fSopenharmony_ci  });
533bc03f14fSopenharmony_ci
534bc03f14fSopenharmony_ci  /**
535bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test21
536bc03f14fSopenharmony_ci   * @tc.desc      Delete one want
537bc03f14fSopenharmony_ci   * @tc.type      Function
538bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
539bc03f14fSopenharmony_ci   */
540bc03f14fSopenharmony_ci  it('pasteboard_promise_test21', 0, async function (done) {
541bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
542bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
543bc03f14fSopenharmony_ci    const want21 = {
544bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication8',
545bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication8.MainAbility',
546bc03f14fSopenharmony_ci    };
547bc03f14fSopenharmony_ci    const pasteData = pasteboard.createWantData(want21);
548bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
549bc03f14fSopenharmony_ci    const res21 = await systemPasteboard.hasPasteData();
550bc03f14fSopenharmony_ci    expect(res21).assertEqual(true);
551bc03f14fSopenharmony_ci    const pasteData21 = await systemPasteboard.getPasteData();
552bc03f14fSopenharmony_ci    expect(pasteData21.getRecordCount()).assertEqual(1);
553bc03f14fSopenharmony_ci    expect(pasteData21.removeRecordAt(0)).assertEqual(true);
554bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData21);
555bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
556bc03f14fSopenharmony_ci      const recordCount21 = data.getRecordCount();
557bc03f14fSopenharmony_ci      expect(recordCount21).assertEqual(0);
558bc03f14fSopenharmony_ci      done();
559bc03f14fSopenharmony_ci    });
560bc03f14fSopenharmony_ci  });
561bc03f14fSopenharmony_ci
562bc03f14fSopenharmony_ci  /**
563bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test22
564bc03f14fSopenharmony_ci   * @tc.desc      Deletes 300K PlainTextData
565bc03f14fSopenharmony_ci   * @tc.type      Function
566bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
567bc03f14fSopenharmony_ci   */
568bc03f14fSopenharmony_ci  it('pasteboard_promise_test22', 0, async function (done) {
569bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
570bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
571bc03f14fSopenharmony_ci    let textData22 = '';
572bc03f14fSopenharmony_ci    for (let i = 0; i < 300; i++) {
573bc03f14fSopenharmony_ci      textData22 = textData22 + 'A';
574bc03f14fSopenharmony_ci    }
575bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData22);
576bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
577bc03f14fSopenharmony_ci    const res22 = await systemPasteboard.hasPasteData();
578bc03f14fSopenharmony_ci    expect(res22).assertEqual(true);
579bc03f14fSopenharmony_ci    const pasteData22 = await systemPasteboard.getPasteData();
580bc03f14fSopenharmony_ci    expect(pasteData22.getRecordCount()).assertEqual(1);
581bc03f14fSopenharmony_ci    expect(pasteData22.removeRecordAt(0)).assertEqual(true);
582bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData22);
583bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
584bc03f14fSopenharmony_ci      const recordCount22 = data.getRecordCount();
585bc03f14fSopenharmony_ci      expect(recordCount22).assertEqual(0);
586bc03f14fSopenharmony_ci      done();
587bc03f14fSopenharmony_ci    });
588bc03f14fSopenharmony_ci  });
589bc03f14fSopenharmony_ci
590bc03f14fSopenharmony_ci  /**
591bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test23
592bc03f14fSopenharmony_ci   * @tc.desc      Deletes 30 record(s)
593bc03f14fSopenharmony_ci   * @tc.type      Function
594bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
595bc03f14fSopenharmony_ci   */
596bc03f14fSopenharmony_ci  it('pasteboard_promise_test23', 0, async function (done) {
597bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
598bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
599bc03f14fSopenharmony_ci    const textData230 = 'Hello World';
600bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData230);
601bc03f14fSopenharmony_ci    let textData23 = '';
602bc03f14fSopenharmony_ci    for (let i = 1; i < 30; i++) {
603bc03f14fSopenharmony_ci      textData23 = 'Hello World';
604bc03f14fSopenharmony_ci      textData23 = textData23 + i;
605bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData23);
606bc03f14fSopenharmony_ci    }
607bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
608bc03f14fSopenharmony_ci    const res23 = await systemPasteboard.hasPasteData();
609bc03f14fSopenharmony_ci    expect(res23).assertEqual(true);
610bc03f14fSopenharmony_ci    const pasteData23 = await systemPasteboard.getPasteData();
611bc03f14fSopenharmony_ci    expect(pasteData23.getRecordCount()).assertEqual(30);
612bc03f14fSopenharmony_ci    for (let i = 0; i < 30; i++) {
613bc03f14fSopenharmony_ci      expect(pasteData23.removeRecordAt(0)).assertEqual(true);
614bc03f14fSopenharmony_ci    }
615bc03f14fSopenharmony_ci    expect(pasteData23.getRecordCount()).assertEqual(0);
616bc03f14fSopenharmony_ci    systemPasteboard.setPasteData(pasteData23).then(() => {
617bc03f14fSopenharmony_ci      systemPasteboard.getPasteData().then((data) => {
618bc03f14fSopenharmony_ci        let recordCount23 = data.getRecordCount();
619bc03f14fSopenharmony_ci        expect(recordCount23).assertEqual(0);
620bc03f14fSopenharmony_ci        done();
621bc03f14fSopenharmony_ci      });
622bc03f14fSopenharmony_ci    });
623bc03f14fSopenharmony_ci  });
624bc03f14fSopenharmony_ci
625bc03f14fSopenharmony_ci  /**
626bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test24
627bc03f14fSopenharmony_ci   * @tc.desc      Deletes replaced record
628bc03f14fSopenharmony_ci   * @tc.type      Function
629bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
630bc03f14fSopenharmony_ci   */
631bc03f14fSopenharmony_ci  it('pasteboard_promise_test24', 0, async function (done) {
632bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
633bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
634bc03f14fSopenharmony_ci    const textData24 = 'Hello World!';
635bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData24);
636bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
637bc03f14fSopenharmony_ci    const res24 = await systemPasteboard.hasPasteData();
638bc03f14fSopenharmony_ci    expect(res24).assertEqual(true);
639bc03f14fSopenharmony_ci    const pasteData24 = await systemPasteboard.getPasteData();
640bc03f14fSopenharmony_ci    expect(pasteData24.getRecordCount()).assertEqual(1);
641bc03f14fSopenharmony_ci    const textData241 = 'Hello World1';
642bc03f14fSopenharmony_ci    const pasteDataRecord = pasteboard.createPlainTextRecord(textData241);
643bc03f14fSopenharmony_ci    const replace = pasteData24.replaceRecordAt(0, pasteDataRecord);
644bc03f14fSopenharmony_ci    expect(replace).assertEqual(true);
645bc03f14fSopenharmony_ci    const primaryText = pasteData24.getPrimaryText();
646bc03f14fSopenharmony_ci    expect(primaryText).assertEqual(textData241);
647bc03f14fSopenharmony_ci    expect(pasteData24.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN)).assertEqual(true);
648bc03f14fSopenharmony_ci    const dataRecord = pasteData24.getRecordAt(0);
649bc03f14fSopenharmony_ci    expect(dataRecord.plainText).assertEqual(textData241);
650bc03f14fSopenharmony_ci    expect(pasteData24.removeRecordAt(0)).assertEqual(true);
651bc03f14fSopenharmony_ci    systemPasteboard.setPasteData(pasteData24).then(() => {
652bc03f14fSopenharmony_ci      systemPasteboard.getPasteData().then((data) => {
653bc03f14fSopenharmony_ci        const recordCount24 = data.getRecordCount();
654bc03f14fSopenharmony_ci        expect(recordCount24).assertEqual(0);
655bc03f14fSopenharmony_ci        done();
656bc03f14fSopenharmony_ci      });
657bc03f14fSopenharmony_ci    });
658bc03f14fSopenharmony_ci  });
659bc03f14fSopenharmony_ci
660bc03f14fSopenharmony_ci  /**
661bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test25
662bc03f14fSopenharmony_ci   * @tc.desc      Deletes 文本、uri、html
663bc03f14fSopenharmony_ci   * @tc.type      Function
664bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
665bc03f14fSopenharmony_ci   */
666bc03f14fSopenharmony_ci  it('pasteboard_promise_test25', 0, async function (done) {
667bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
668bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
669bc03f14fSopenharmony_ci    const textData25 = 'Hello World!';
670bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData25);
671bc03f14fSopenharmony_ci    const htmlText25 = '<html><head></head><body>Hello World!</body></html>';
672bc03f14fSopenharmony_ci    pasteData.addHtmlRecord(htmlText25);
673bc03f14fSopenharmony_ci    const uriText25 = 'https://www.baidu.com/';
674bc03f14fSopenharmony_ci    pasteData.addUriRecord(uriText25);
675bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
676bc03f14fSopenharmony_ci    const res25 = await systemPasteboard.hasPasteData();
677bc03f14fSopenharmony_ci    expect(res25).assertEqual(true);
678bc03f14fSopenharmony_ci    const pasteData25 = await systemPasteboard.getPasteData();
679bc03f14fSopenharmony_ci    expect(pasteData25.getRecordCount()).assertEqual(3);
680bc03f14fSopenharmony_ci    expect(pasteData25.removeRecordAt(0)).assertEqual(true);
681bc03f14fSopenharmony_ci    expect(pasteData25.removeRecordAt(0)).assertEqual(true);
682bc03f14fSopenharmony_ci    expect(pasteData25.removeRecordAt(0)).assertEqual(true);
683bc03f14fSopenharmony_ci    systemPasteboard.setPasteData(pasteData25).then(() => {
684bc03f14fSopenharmony_ci      systemPasteboard.getPasteData().then((data) => {
685bc03f14fSopenharmony_ci        const recordCount25 = data.getRecordCount();
686bc03f14fSopenharmony_ci        expect(recordCount25).assertEqual(0);
687bc03f14fSopenharmony_ci        done();
688bc03f14fSopenharmony_ci      });
689bc03f14fSopenharmony_ci    });
690bc03f14fSopenharmony_ci  });
691bc03f14fSopenharmony_ci
692bc03f14fSopenharmony_ci  /**
693bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test26
694bc03f14fSopenharmony_ci   * @tc.desc      Replaces 文本 record
695bc03f14fSopenharmony_ci   * @tc.type      Function
696bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
697bc03f14fSopenharmony_ci   */
698bc03f14fSopenharmony_ci  it('pasteboard_promise_test26', 0, async function (done) {
699bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
700bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
701bc03f14fSopenharmony_ci    const textData26 = 'Hello World!';
702bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData26);
703bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
704bc03f14fSopenharmony_ci    const res26 = await systemPasteboard.hasPasteData();
705bc03f14fSopenharmony_ci    expect(res26).assertEqual(true);
706bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
707bc03f14fSopenharmony_ci      const pasteData26 = data;
708bc03f14fSopenharmony_ci      expect(pasteData26.getRecordCount()).assertEqual(1);
709bc03f14fSopenharmony_ci      const textData261 = 'Hello World1';
710bc03f14fSopenharmony_ci      const pasteDataRecord = pasteboard.createPlainTextRecord(textData261);
711bc03f14fSopenharmony_ci      const replace26 = pasteData26.replaceRecordAt(0, pasteDataRecord);
712bc03f14fSopenharmony_ci      expect(replace26).assertEqual(true);
713bc03f14fSopenharmony_ci      const primaryText26 = pasteData26.getPrimaryText();
714bc03f14fSopenharmony_ci      expect(primaryText26).assertEqual(textData261);
715bc03f14fSopenharmony_ci      done();
716bc03f14fSopenharmony_ci    });
717bc03f14fSopenharmony_ci  });
718bc03f14fSopenharmony_ci
719bc03f14fSopenharmony_ci  /**
720bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test27
721bc03f14fSopenharmony_ci   * @tc.desc      Replaces htmlText record
722bc03f14fSopenharmony_ci   * @tc.type      Function
723bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
724bc03f14fSopenharmony_ci   */
725bc03f14fSopenharmony_ci  it('pasteboard_promise_test27', 0, async function (done) {
726bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
727bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
728bc03f14fSopenharmony_ci    const htmlText27 = '<html><head></head><body>Hello World!</body></html>';
729bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText27);
730bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
731bc03f14fSopenharmony_ci    const res27 = await systemPasteboard.hasPasteData();
732bc03f14fSopenharmony_ci    expect(res27).assertEqual(true);
733bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
734bc03f14fSopenharmony_ci      const pasteData27 = data;
735bc03f14fSopenharmony_ci      expect(pasteData27.getRecordCount()).assertEqual(1);
736bc03f14fSopenharmony_ci      const htmlText27 = '<html><head></head><body>Hello World 1</body></html>';
737bc03f14fSopenharmony_ci      const pasteDataRecord = pasteboard.createHtmlTextRecord(htmlText27);
738bc03f14fSopenharmony_ci      const replace27 = pasteData27.replaceRecordAt(0, pasteDataRecord);
739bc03f14fSopenharmony_ci      expect(replace27).assertEqual(true);
740bc03f14fSopenharmony_ci      const primaryHtml271 = pasteData27.getPrimaryHtml();
741bc03f14fSopenharmony_ci      expect(primaryHtml271).assertEqual(htmlText27);
742bc03f14fSopenharmony_ci      expect(pasteData27.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
743bc03f14fSopenharmony_ci      const primaryHtml272 = pasteData27.getPrimaryHtml();
744bc03f14fSopenharmony_ci      expect(primaryHtml272).assertEqual(htmlText27);
745bc03f14fSopenharmony_ci      done();
746bc03f14fSopenharmony_ci    });
747bc03f14fSopenharmony_ci  });
748bc03f14fSopenharmony_ci
749bc03f14fSopenharmony_ci  /**
750bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test28
751bc03f14fSopenharmony_ci   * @tc.desc      Replaces uri record
752bc03f14fSopenharmony_ci   * @tc.type      Function
753bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
754bc03f14fSopenharmony_ci   */
755bc03f14fSopenharmony_ci  it('pasteboard_promise_test28', 0, async function (done) {
756bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
757bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
758bc03f14fSopenharmony_ci    const uriText28 = 'https://www.baidu.com/';
759bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText28);
760bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
761bc03f14fSopenharmony_ci    const res28 = await systemPasteboard.hasPasteData();
762bc03f14fSopenharmony_ci    expect(res28).assertEqual(true);
763bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
764bc03f14fSopenharmony_ci      const pasteData28 = data;
765bc03f14fSopenharmony_ci      expect(pasteData28.getRecordCount()).assertEqual(1);
766bc03f14fSopenharmony_ci      const uriText281 = 'https://www.baidu.com/1';
767bc03f14fSopenharmony_ci      const pasteDataRecord = pasteboard.createUriRecord(uriText281);
768bc03f14fSopenharmony_ci      const replace28 = pasteData28.replaceRecordAt(0, pasteDataRecord);
769bc03f14fSopenharmony_ci      expect(replace28).assertEqual(true);
770bc03f14fSopenharmony_ci      const primaryUri1 = pasteData28.getPrimaryUri();
771bc03f14fSopenharmony_ci      expect(primaryUri1).assertEqual(uriText281);
772bc03f14fSopenharmony_ci      expect(pasteData28.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true);
773bc03f14fSopenharmony_ci      const primaryUri2 = pasteData28.getPrimaryUri();
774bc03f14fSopenharmony_ci      expect(primaryUri2).assertEqual(uriText281);
775bc03f14fSopenharmony_ci      done();
776bc03f14fSopenharmony_ci    });
777bc03f14fSopenharmony_ci  });
778bc03f14fSopenharmony_ci
779bc03f14fSopenharmony_ci  /**
780bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test29
781bc03f14fSopenharmony_ci   * @tc.desc      Replaces want record
782bc03f14fSopenharmony_ci   * @tc.type      Function
783bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
784bc03f14fSopenharmony_ci   */
785bc03f14fSopenharmony_ci  it('pasteboard_promise_test29', 0, async function (done) {
786bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
787bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
788bc03f14fSopenharmony_ci    const wantText29 = {
789bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication3',
790bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication3.MainAbility',
791bc03f14fSopenharmony_ci    };
792bc03f14fSopenharmony_ci    const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_WANT, wantText29);
793bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
794bc03f14fSopenharmony_ci    const res29 = await systemPasteboard.hasPasteData();
795bc03f14fSopenharmony_ci    expect(res29).assertEqual(true);
796bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
797bc03f14fSopenharmony_ci      const pasteData29 = data;
798bc03f14fSopenharmony_ci      expect(pasteData29.getRecordCount()).assertEqual(1);
799bc03f14fSopenharmony_ci      const wantText291 = {
800bc03f14fSopenharmony_ci        bundleName: 'com.example.myapplication30',
801bc03f14fSopenharmony_ci        abilityName: 'com.example.myapplication30.MainAbility',
802bc03f14fSopenharmony_ci      };
803bc03f14fSopenharmony_ci      const pasteDataRecord = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_WANT, wantText291);
804bc03f14fSopenharmony_ci      const replace29 = pasteData29.replaceRecordAt(0, pasteDataRecord);
805bc03f14fSopenharmony_ci      expect(replace29).assertEqual(true);
806bc03f14fSopenharmony_ci      const primaryWant29 = pasteData29.getPrimaryWant();
807bc03f14fSopenharmony_ci      expect(primaryWant29.bundleName).assertEqual(wantText291.bundleName);
808bc03f14fSopenharmony_ci      expect(primaryWant29.abilityName).assertEqual(wantText291.abilityName);
809bc03f14fSopenharmony_ci      done();
810bc03f14fSopenharmony_ci    });
811bc03f14fSopenharmony_ci  });
812bc03f14fSopenharmony_ci
813bc03f14fSopenharmony_ci  /**
814bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test30
815bc03f14fSopenharmony_ci   * @tc.desc      Replaces 300k文本 record
816bc03f14fSopenharmony_ci   * @tc.type      Function
817bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
818bc03f14fSopenharmony_ci   */
819bc03f14fSopenharmony_ci  it('pasteboard_promise_test30', 0, async function (done) {
820bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
821bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
822bc03f14fSopenharmony_ci    let textData30 = '';
823bc03f14fSopenharmony_ci    for (let i = 0; i < 300; i++) {
824bc03f14fSopenharmony_ci      textData30 = textData30 + 'A';
825bc03f14fSopenharmony_ci    }
826bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData30);
827bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
828bc03f14fSopenharmony_ci    const res30 = await systemPasteboard.hasPasteData();
829bc03f14fSopenharmony_ci    expect(res30).assertEqual(true);
830bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
831bc03f14fSopenharmony_ci      const pasteData30 = data;
832bc03f14fSopenharmony_ci      expect(pasteData30.getRecordCount()).assertEqual(1);
833bc03f14fSopenharmony_ci      const textData301 = 'Hello World1';
834bc03f14fSopenharmony_ci      const pasteDataRecord = pasteboard.createPlainTextRecord(textData301);
835bc03f14fSopenharmony_ci      const replace = pasteData30.replaceRecordAt(0, pasteDataRecord);
836bc03f14fSopenharmony_ci      expect(replace).assertEqual(true);
837bc03f14fSopenharmony_ci      const primaryText = pasteData30.getPrimaryText();
838bc03f14fSopenharmony_ci      expect(primaryText).assertEqual(textData301);
839bc03f14fSopenharmony_ci      done();
840bc03f14fSopenharmony_ci    });
841bc03f14fSopenharmony_ci  });
842bc03f14fSopenharmony_ci
843bc03f14fSopenharmony_ci  /**
844bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test31
845bc03f14fSopenharmony_ci   * @tc.desc      Clears pasteBoard, gets record count
846bc03f14fSopenharmony_ci   * @tc.type      Function
847bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
848bc03f14fSopenharmony_ci   */
849bc03f14fSopenharmony_ci  it('pasteboard_promise_test31', 0, async function (done) {
850bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
851bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
852bc03f14fSopenharmony_ci    const textData31 = 'Hello World!';
853bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData31);
854bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
855bc03f14fSopenharmony_ci    const res31 = await systemPasteboard.hasPasteData();
856bc03f14fSopenharmony_ci    expect(res31).assertEqual(true);
857bc03f14fSopenharmony_ci    const pasteData31 = await systemPasteboard.getPasteData();
858bc03f14fSopenharmony_ci    expect(pasteData31.getRecordCount()).assertEqual(1);
859bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
860bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
861bc03f14fSopenharmony_ci      const pasteData2 = data;
862bc03f14fSopenharmony_ci      const recordCount = pasteData2.getRecordCount();
863bc03f14fSopenharmony_ci      expect(recordCount).assertEqual(0);
864bc03f14fSopenharmony_ci      done();
865bc03f14fSopenharmony_ci    });
866bc03f14fSopenharmony_ci  });
867bc03f14fSopenharmony_ci
868bc03f14fSopenharmony_ci  /**
869bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test32
870bc03f14fSopenharmony_ci   * @tc.desc      Adds Property
871bc03f14fSopenharmony_ci   * @tc.type      Function
872bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
873bc03f14fSopenharmony_ci   */
874bc03f14fSopenharmony_ci  it('pasteboard_promise_test32', 0, async function (done) {
875bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
876bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
877bc03f14fSopenharmony_ci    const textData32 = 'Hello World!';
878bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData32);
879bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
880bc03f14fSopenharmony_ci    const res32 = await systemPasteboard.hasPasteData();
881bc03f14fSopenharmony_ci    expect(res32).assertEqual(true);
882bc03f14fSopenharmony_ci    const pasteData32 = await systemPasteboard.getPasteData();
883bc03f14fSopenharmony_ci    expect(pasteData32.getRecordCount()).assertEqual(1);
884bc03f14fSopenharmony_ci    const pasteDataProperty = pasteData32.getProperty();
885bc03f14fSopenharmony_ci    expect(pasteDataProperty.shareOption).assertEqual(pasteboard.ShareOption.CrossDevice);
886bc03f14fSopenharmony_ci    pasteDataProperty.shareOption = pasteboard.ShareOption.InApp;
887bc03f14fSopenharmony_ci    pasteData32.setProperty(pasteDataProperty);
888bc03f14fSopenharmony_ci    expect(pasteData32.getProperty().shareOption).assertEqual(pasteboard.ShareOption.InApp);
889bc03f14fSopenharmony_ci    done();
890bc03f14fSopenharmony_ci  });
891bc03f14fSopenharmony_ci
892bc03f14fSopenharmony_ci  /**
893bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test33
894bc03f14fSopenharmony_ci   * @tc.desc      Clears pasteBoard and check property
895bc03f14fSopenharmony_ci   * @tc.type      Function
896bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
897bc03f14fSopenharmony_ci   */
898bc03f14fSopenharmony_ci  it('pasteboard_promise_test33', 0, async function (done) {
899bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
900bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
901bc03f14fSopenharmony_ci    const textData33 = 'Hello World!';
902bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData33);
903bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
904bc03f14fSopenharmony_ci    const res33 = await systemPasteboard.hasPasteData();
905bc03f14fSopenharmony_ci    expect(res33).assertEqual(true);
906bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then(async (data) => {
907bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
908bc03f14fSopenharmony_ci      await systemPasteboard.clearData();
909bc03f14fSopenharmony_ci      const newPasteData = await systemPasteboard.getPasteData();
910bc03f14fSopenharmony_ci      expect(newPasteData.getProperty().shareOption).assertEqual(pasteboard.ShareOption.CrossDevice);
911bc03f14fSopenharmony_ci      done();
912bc03f14fSopenharmony_ci    });
913bc03f14fSopenharmony_ci  });
914bc03f14fSopenharmony_ci
915bc03f14fSopenharmony_ci  /**
916bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test34
917bc03f14fSopenharmony_ci   * @tc.desc      打开内容变化通知功能
918bc03f14fSopenharmony_ci   * @tc.type      Function
919bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
920bc03f14fSopenharmony_ci   */
921bc03f14fSopenharmony_ci  it('pasteboard_promise_test34', 0, async function (done) {
922bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
923bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
924bc03f14fSopenharmony_ci    systemPasteboard.on('update', contentChanges);
925bc03f14fSopenharmony_ci    const textData34 = 'Hello World!';
926bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData34);
927bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
928bc03f14fSopenharmony_ci    const res34 = await systemPasteboard.hasPasteData();
929bc03f14fSopenharmony_ci    expect(res34).assertEqual(true);
930bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
931bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
932bc03f14fSopenharmony_ci      expect(data.removeRecordAt(0)).assertEqual(true);
933bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(0);
934bc03f14fSopenharmony_ci      done();
935bc03f14fSopenharmony_ci    });
936bc03f14fSopenharmony_ci  });
937bc03f14fSopenharmony_ci
938bc03f14fSopenharmony_ci  /**
939bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test35
940bc03f14fSopenharmony_ci   * @tc.desc      清除剪切板内的文本数据项
941bc03f14fSopenharmony_ci   * @tc.type      Function
942bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
943bc03f14fSopenharmony_ci   */
944bc03f14fSopenharmony_ci  it('pasteboard_promise_test35', 0, async function (done) {
945bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
946bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
947bc03f14fSopenharmony_ci    const textData35 = 'Hello World!';
948bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData35);
949bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
950bc03f14fSopenharmony_ci    const res35 = await systemPasteboard.hasPasteData();
951bc03f14fSopenharmony_ci    expect(res35).assertEqual(true);
952bc03f14fSopenharmony_ci    const pasteData35 = await systemPasteboard.getPasteData();
953bc03f14fSopenharmony_ci    expect(pasteData35.getRecordCount()).assertEqual(1);
954bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
955bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
956bc03f14fSopenharmony_ci      const recordCount35 = data.getRecordCount();
957bc03f14fSopenharmony_ci      expect(recordCount35).assertEqual(0);
958bc03f14fSopenharmony_ci      done();
959bc03f14fSopenharmony_ci    });
960bc03f14fSopenharmony_ci  });
961bc03f14fSopenharmony_ci
962bc03f14fSopenharmony_ci  /**
963bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test36
964bc03f14fSopenharmony_ci   * @tc.desc      清除剪切板内的uri数据项
965bc03f14fSopenharmony_ci   * @tc.type      Function
966bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
967bc03f14fSopenharmony_ci   */
968bc03f14fSopenharmony_ci  it('pasteboard_promise_test36', 0, async function (done) {
969bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
970bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
971bc03f14fSopenharmony_ci    const uriText36 = 'https://www.baidu.com/';
972bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText36);
973bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
974bc03f14fSopenharmony_ci    const res36 = await systemPasteboard.hasPasteData();
975bc03f14fSopenharmony_ci    expect(res36).assertEqual(true);
976bc03f14fSopenharmony_ci    const pasteData36 = await systemPasteboard.getPasteData();
977bc03f14fSopenharmony_ci    expect(pasteData36.getRecordCount()).assertEqual(1);
978bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
979bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
980bc03f14fSopenharmony_ci      const recordCount36 = data.getRecordCount();
981bc03f14fSopenharmony_ci      expect(recordCount36).assertEqual(0);
982bc03f14fSopenharmony_ci      done();
983bc03f14fSopenharmony_ci    });
984bc03f14fSopenharmony_ci  });
985bc03f14fSopenharmony_ci
986bc03f14fSopenharmony_ci  /**
987bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test37
988bc03f14fSopenharmony_ci   * @tc.desc      清除剪切板内的html数据项
989bc03f14fSopenharmony_ci   * @tc.type      Function
990bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
991bc03f14fSopenharmony_ci   */
992bc03f14fSopenharmony_ci  it('pasteboard_promise_test37', 0, async function (done) {
993bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
994bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
995bc03f14fSopenharmony_ci    const htmlText37 = '<html><head></head><body>Hello World!</body></html>';
996bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText37);
997bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
998bc03f14fSopenharmony_ci    const res37 = await systemPasteboard.hasPasteData();
999bc03f14fSopenharmony_ci    expect(res37).assertEqual(true);
1000bc03f14fSopenharmony_ci    const pasteData37 = await systemPasteboard.getPasteData();
1001bc03f14fSopenharmony_ci    expect(pasteData37.getRecordCount()).assertEqual(1);
1002bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1003bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1004bc03f14fSopenharmony_ci      const recordCount37 = data.getRecordCount();
1005bc03f14fSopenharmony_ci      expect(recordCount37).assertEqual(0);
1006bc03f14fSopenharmony_ci      done();
1007bc03f14fSopenharmony_ci    });
1008bc03f14fSopenharmony_ci  });
1009bc03f14fSopenharmony_ci
1010bc03f14fSopenharmony_ci  /**
1011bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test38
1012bc03f14fSopenharmony_ci   * @tc.desc      清除剪切板内的want数据项
1013bc03f14fSopenharmony_ci   * @tc.type      Function
1014bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
1015bc03f14fSopenharmony_ci   */
1016bc03f14fSopenharmony_ci  it('pasteboard_promise_test38', 0, async function (done) {
1017bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1018bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1019bc03f14fSopenharmony_ci    const myWant38 = {
1020bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication55',
1021bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication55.MainAbility',
1022bc03f14fSopenharmony_ci    };
1023bc03f14fSopenharmony_ci    const pasteData381 = pasteboard.createWantData(myWant38);
1024bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData381);
1025bc03f14fSopenharmony_ci    const res38 = await systemPasteboard.hasPasteData();
1026bc03f14fSopenharmony_ci    expect(res38).assertEqual(true);
1027bc03f14fSopenharmony_ci    const pasteData38 = await systemPasteboard.getPasteData();
1028bc03f14fSopenharmony_ci    expect(pasteData38.getRecordCount()).assertEqual(1);
1029bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1030bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1031bc03f14fSopenharmony_ci      const recordCount38 = data.getRecordCount();
1032bc03f14fSopenharmony_ci      expect(recordCount38).assertEqual(0);
1033bc03f14fSopenharmony_ci      done();
1034bc03f14fSopenharmony_ci    });
1035bc03f14fSopenharmony_ci  });
1036bc03f14fSopenharmony_ci
1037bc03f14fSopenharmony_ci  /**
1038bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test39
1039bc03f14fSopenharmony_ci   * @tc.desc      向剪切板内增加30条数据项,然后清除
1040bc03f14fSopenharmony_ci   * @tc.type      Function
1041bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
1042bc03f14fSopenharmony_ci   */
1043bc03f14fSopenharmony_ci  it('pasteboard_promise_test39', 0, async function (done) {
1044bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1045bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1046bc03f14fSopenharmony_ci    const textData390 = 'Hello World!';
1047bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData390);
1048bc03f14fSopenharmony_ci    let textData39 = '';
1049bc03f14fSopenharmony_ci    for (let i = 1; i < 30; i++) {
1050bc03f14fSopenharmony_ci      textData39 = 'Hello World';
1051bc03f14fSopenharmony_ci      textData39 = textData39 + i;
1052bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData39);
1053bc03f14fSopenharmony_ci    }
1054bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1055bc03f14fSopenharmony_ci    const res39 = await systemPasteboard.hasPasteData();
1056bc03f14fSopenharmony_ci    expect(res39).assertEqual(true);
1057bc03f14fSopenharmony_ci    const pasteData39 = await systemPasteboard.getPasteData();
1058bc03f14fSopenharmony_ci    expect(pasteData39.getRecordCount()).assertEqual(30);
1059bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1060bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1061bc03f14fSopenharmony_ci      const recordCount39 = data.getRecordCount();
1062bc03f14fSopenharmony_ci      expect(recordCount39).assertEqual(0);
1063bc03f14fSopenharmony_ci      done();
1064bc03f14fSopenharmony_ci    });
1065bc03f14fSopenharmony_ci  });
1066bc03f14fSopenharmony_ci
1067bc03f14fSopenharmony_ci  /**
1068bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test40
1069bc03f14fSopenharmony_ci   * @tc.desc      向剪贴板数据各增加5条文本、uri、html数据,然后清除
1070bc03f14fSopenharmony_ci   * @tc.type      Function
1071bc03f14fSopenharmony_ci   * @tc.require   AR000H5I1D
1072bc03f14fSopenharmony_ci   */
1073bc03f14fSopenharmony_ci  it('pasteboard_promise_test40', 0, async function (done) {
1074bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1075bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1076bc03f14fSopenharmony_ci    const textData400 = 'Hello World0';
1077bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData400);
1078bc03f14fSopenharmony_ci    let textData40 = '';
1079bc03f14fSopenharmony_ci    for (let i = 1; i < 5; i++) {
1080bc03f14fSopenharmony_ci      textData40 = 'Hello World';
1081bc03f14fSopenharmony_ci      textData40 = textData40 + i;
1082bc03f14fSopenharmony_ci      pasteData.addTextRecord(textData40);
1083bc03f14fSopenharmony_ci    }
1084bc03f14fSopenharmony_ci    let htmlText40 = '';
1085bc03f14fSopenharmony_ci    for (let i = 0; i < 5; i++) {
1086bc03f14fSopenharmony_ci      htmlText40 = '<html><head></head><body>Hello World!</body></html>';
1087bc03f14fSopenharmony_ci      htmlText40 = htmlText40 + i;
1088bc03f14fSopenharmony_ci      pasteData.addHtmlRecord(htmlText40);
1089bc03f14fSopenharmony_ci    }
1090bc03f14fSopenharmony_ci    let uriText40 = '';
1091bc03f14fSopenharmony_ci    for (let i = 0; i < 5; i++) {
1092bc03f14fSopenharmony_ci      uriText40 = 'https://www.baidu.com/';
1093bc03f14fSopenharmony_ci      uriText40 = uriText40 + i;
1094bc03f14fSopenharmony_ci      pasteData.addUriRecord(uriText40);
1095bc03f14fSopenharmony_ci    }
1096bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1097bc03f14fSopenharmony_ci    const res40 = await systemPasteboard.hasPasteData();
1098bc03f14fSopenharmony_ci    expect(res40).assertEqual(true);
1099bc03f14fSopenharmony_ci    const data40 = await systemPasteboard.getPasteData();
1100bc03f14fSopenharmony_ci    expect(data40.getRecordCount()).assertEqual(15);
1101bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1102bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1103bc03f14fSopenharmony_ci      const recordCount40 = data.getRecordCount();
1104bc03f14fSopenharmony_ci      expect(recordCount40).assertEqual(0);
1105bc03f14fSopenharmony_ci      done();
1106bc03f14fSopenharmony_ci    });
1107bc03f14fSopenharmony_ci  });
1108bc03f14fSopenharmony_ci
1109bc03f14fSopenharmony_ci  /**
1110bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test41
1111bc03f14fSopenharmony_ci   * @tc.desc      更新剪贴板数据,查询剪贴板存在剪贴板数据
1112bc03f14fSopenharmony_ci   * @tc.type      Function
1113bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1114bc03f14fSopenharmony_ci   */
1115bc03f14fSopenharmony_ci  it('pasteboard_promise_test41', 0, async function (done) {
1116bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1117bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1118bc03f14fSopenharmony_ci    const textData41 = 'Hello World!';
1119bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData41);
1120bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1121bc03f14fSopenharmony_ci    const res41 = await systemPasteboard.hasPasteData();
1122bc03f14fSopenharmony_ci    expect(res41).assertEqual(true);
1123bc03f14fSopenharmony_ci    const pasteData41 = await systemPasteboard.getPasteData();
1124bc03f14fSopenharmony_ci    expect(pasteData41.getRecordCount()).assertEqual(1);
1125bc03f14fSopenharmony_ci    const textData411 = 'Hello World1';
1126bc03f14fSopenharmony_ci    const pasteDataRecord = pasteboard.createPlainTextRecord(textData411);
1127bc03f14fSopenharmony_ci    const replace41 = pasteData41.replaceRecordAt(0, pasteDataRecord);
1128bc03f14fSopenharmony_ci    expect(replace41).assertEqual(true);
1129bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData41);
1130bc03f14fSopenharmony_ci    systemPasteboard.hasPasteData().then(async (data) => {
1131bc03f14fSopenharmony_ci      expect(data).assertEqual(true);
1132bc03f14fSopenharmony_ci      const newData41 = await systemPasteboard.getPasteData();
1133bc03f14fSopenharmony_ci      expect(newData41.getPrimaryText()).assertEqual(textData411);
1134bc03f14fSopenharmony_ci      const newPasteDataRecord = newData41.getRecordAt(0);
1135bc03f14fSopenharmony_ci      expect(newPasteDataRecord.plainText).assertEqual(textData411);
1136bc03f14fSopenharmony_ci      done();
1137bc03f14fSopenharmony_ci    });
1138bc03f14fSopenharmony_ci  });
1139bc03f14fSopenharmony_ci
1140bc03f14fSopenharmony_ci  /**
1141bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test42
1142bc03f14fSopenharmony_ci   * @tc.desc      删除所有的剪贴板数据,查询剪贴板不存在剪贴板数据
1143bc03f14fSopenharmony_ci   * @tc.type      Function
1144bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1145bc03f14fSopenharmony_ci   */
1146bc03f14fSopenharmony_ci  it('pasteboard_promise_test42', 0, async function (done) {
1147bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1148bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1149bc03f14fSopenharmony_ci    const textData42 = 'Hello World!';
1150bc03f14fSopenharmony_ci    const data42 = pasteboard.createPlainTextData(textData42);
1151bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(data42);
1152bc03f14fSopenharmony_ci    const res42 = await systemPasteboard.hasPasteData();
1153bc03f14fSopenharmony_ci    expect(res42).assertEqual(true);
1154bc03f14fSopenharmony_ci    const pasteData42 = await systemPasteboard.getPasteData();
1155bc03f14fSopenharmony_ci    const recordCount = pasteData42.getRecordCount();
1156bc03f14fSopenharmony_ci    expect(recordCount).assertEqual(1);
1157bc03f14fSopenharmony_ci    expect(pasteData42.removeRecordAt(0)).assertEqual(true);
1158bc03f14fSopenharmony_ci    expect(pasteData42.getRecordCount()).assertEqual(0);
1159bc03f14fSopenharmony_ci    const newData42 = await systemPasteboard.getPasteData();
1160bc03f14fSopenharmony_ci    expect(newData42.getRecordCount()).assertEqual(1);
1161bc03f14fSopenharmony_ci    done();
1162bc03f14fSopenharmony_ci  });
1163bc03f14fSopenharmony_ci
1164bc03f14fSopenharmony_ci  /**
1165bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test43
1166bc03f14fSopenharmony_ci   * @tc.desc      将文本数据强制转换为文本
1167bc03f14fSopenharmony_ci   * @tc.type      Function
1168bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1169bc03f14fSopenharmony_ci   */
1170bc03f14fSopenharmony_ci  it('pasteboard_promise_test43', 0, async function (done) {
1171bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1172bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1173bc03f14fSopenharmony_ci    const textData43 = 'Hello World!';
1174bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData43);
1175bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1176bc03f14fSopenharmony_ci    const res43 = await systemPasteboard.hasPasteData();
1177bc03f14fSopenharmony_ci    expect(res43).assertEqual(true);
1178bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then(async (data) => {
1179bc03f14fSopenharmony_ci      const pasteData143 = data;
1180bc03f14fSopenharmony_ci      expect(pasteData143.getRecordCount()).assertEqual(1);
1181bc03f14fSopenharmony_ci      const pasteDataRecord = pasteData143.getRecordAt(0);
1182bc03f14fSopenharmony_ci      const text43 = await pasteDataRecord.convertToText();
1183bc03f14fSopenharmony_ci      expect(text43).assertEqual(textData43);
1184bc03f14fSopenharmony_ci      done();
1185bc03f14fSopenharmony_ci    });
1186bc03f14fSopenharmony_ci  });
1187bc03f14fSopenharmony_ci
1188bc03f14fSopenharmony_ci  /**
1189bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test44
1190bc03f14fSopenharmony_ci   * @tc.desc      将一条含有特殊字符、中英混杂的文本数据强制转换为文本
1191bc03f14fSopenharmony_ci   * @tc.type      Function
1192bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1193bc03f14fSopenharmony_ci   */
1194bc03f14fSopenharmony_ci  it('pasteboard_promise_test44', 0, async function (done) {
1195bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1196bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1197bc03f14fSopenharmony_ci    const textData44 = 'Hello 中国!@#$%^&*()_+{}?.';
1198bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData44);
1199bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1200bc03f14fSopenharmony_ci    const res44 = await systemPasteboard.hasPasteData();
1201bc03f14fSopenharmony_ci    expect(res44).assertEqual(true);
1202bc03f14fSopenharmony_ci    const pasteData44 = await systemPasteboard.getPasteData();
1203bc03f14fSopenharmony_ci    expect(pasteData44.getRecordCount()).assertEqual(1);
1204bc03f14fSopenharmony_ci    const pasteDataRecord = pasteData44.getRecordAt(0);
1205bc03f14fSopenharmony_ci    pasteDataRecord.convertToText((err, text) => {
1206bc03f14fSopenharmony_ci      if (err) {
1207bc03f14fSopenharmony_ci        console.info('f_test44 pasteDataRecord.convertToText error: ' + error);
1208bc03f14fSopenharmony_ci      } else {
1209bc03f14fSopenharmony_ci        expect(textData44).assertEqual(text);
1210bc03f14fSopenharmony_ci        done();
1211bc03f14fSopenharmony_ci      }
1212bc03f14fSopenharmony_ci    });
1213bc03f14fSopenharmony_ci  });
1214bc03f14fSopenharmony_ci
1215bc03f14fSopenharmony_ci  /**
1216bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test45
1217bc03f14fSopenharmony_ci   * @tc.desc      将一条超长文本数据 (大小为301K)强制转换为文本
1218bc03f14fSopenharmony_ci   * @tc.type      Function
1219bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1220bc03f14fSopenharmony_ci   */
1221bc03f14fSopenharmony_ci  it('pasteboard_promise_test45', 0, async function (done) {
1222bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1223bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1224bc03f14fSopenharmony_ci    let textData45 = '';
1225bc03f14fSopenharmony_ci    for (let i = 0; i < 301; i++) {
1226bc03f14fSopenharmony_ci      textData45 = textData45 + 'A';
1227bc03f14fSopenharmony_ci    }
1228bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData45);
1229bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1230bc03f14fSopenharmony_ci    const res45 = await systemPasteboard.hasPasteData();
1231bc03f14fSopenharmony_ci    expect(res45).assertEqual(true);
1232bc03f14fSopenharmony_ci    const pasteData45 = await systemPasteboard.getPasteData();
1233bc03f14fSopenharmony_ci    expect(pasteData45.getRecordCount()).assertEqual(1);
1234bc03f14fSopenharmony_ci    const pasteDataRecord = pasteData45.getRecordAt(0);
1235bc03f14fSopenharmony_ci    pasteDataRecord.convertToText((err, text) => {
1236bc03f14fSopenharmony_ci      if (err) {
1237bc03f14fSopenharmony_ci        console.info('f_test45 pasteDataRecord.convertToText error: ' + error);
1238bc03f14fSopenharmony_ci      } else {
1239bc03f14fSopenharmony_ci        expect(textData45).assertEqual(text);
1240bc03f14fSopenharmony_ci        done();
1241bc03f14fSopenharmony_ci      }
1242bc03f14fSopenharmony_ci    });
1243bc03f14fSopenharmony_ci  });
1244bc03f14fSopenharmony_ci
1245bc03f14fSopenharmony_ci  /**
1246bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test46
1247bc03f14fSopenharmony_ci   * @tc.desc      将uri数据强制转换为文本
1248bc03f14fSopenharmony_ci   * @tc.type      Function
1249bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1250bc03f14fSopenharmony_ci   */
1251bc03f14fSopenharmony_ci  it('pasteboard_promise_test46', 0, async function (done) {
1252bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1253bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1254bc03f14fSopenharmony_ci    const uriText46 = 'https://www.baidu.com/';
1255bc03f14fSopenharmony_ci    const pasteData = pasteboard.createUriData(uriText46);
1256bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1257bc03f14fSopenharmony_ci    const res46 = await systemPasteboard.hasPasteData();
1258bc03f14fSopenharmony_ci    expect(res46).assertEqual(true);
1259bc03f14fSopenharmony_ci    let pasteData46 = await systemPasteboard.getPasteData();
1260bc03f14fSopenharmony_ci    expect(pasteData46.getRecordCount()).assertEqual(1);
1261bc03f14fSopenharmony_ci    let pasteDataRecord = pasteData46.getRecordAt(0);
1262bc03f14fSopenharmony_ci    pasteDataRecord
1263bc03f14fSopenharmony_ci      .convertToText()
1264bc03f14fSopenharmony_ci      .then((text) => {
1265bc03f14fSopenharmony_ci        expect(uriText46).assertEqual(text);
1266bc03f14fSopenharmony_ci        done();
1267bc03f14fSopenharmony_ci      })
1268bc03f14fSopenharmony_ci      .catch((error) => {
1269bc03f14fSopenharmony_ci        console.info('f_test46 pasteDataRecord.convertToText error: ' + error);
1270bc03f14fSopenharmony_ci      });
1271bc03f14fSopenharmony_ci  });
1272bc03f14fSopenharmony_ci
1273bc03f14fSopenharmony_ci  /**
1274bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test47
1275bc03f14fSopenharmony_ci   * @tc.desc      复制文本、uri格式
1276bc03f14fSopenharmony_ci   * @tc.type      Function
1277bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1278bc03f14fSopenharmony_ci   */
1279bc03f14fSopenharmony_ci  it('pasteboard_promise_test47', 0, async function (done) {
1280bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1281bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1282bc03f14fSopenharmony_ci    const textData470 = 'Hello World0';
1283bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData470);
1284bc03f14fSopenharmony_ci    const uriText47 = pasteboard.createUriRecord('https://www.baidu.com/');
1285bc03f14fSopenharmony_ci    pasteData.addRecord(uriText47);
1286bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1287bc03f14fSopenharmony_ci    const res47 = await systemPasteboard.hasPasteData();
1288bc03f14fSopenharmony_ci    expect(res47).assertEqual(true);
1289bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1290bc03f14fSopenharmony_ci      const recordCount47 = data.getRecordCount();
1291bc03f14fSopenharmony_ci      expect(recordCount47).assertEqual(2);
1292bc03f14fSopenharmony_ci      const pasteDataRecord1 = data.getRecordAt(0);
1293bc03f14fSopenharmony_ci      const pasteDataRecord2 = data.getRecordAt(1);
1294bc03f14fSopenharmony_ci      expect(pasteDataRecord1.uri).assertEqual(uriText47.uri);
1295bc03f14fSopenharmony_ci      expect(pasteDataRecord2.plainText).assertEqual(textData470);
1296bc03f14fSopenharmony_ci      done();
1297bc03f14fSopenharmony_ci    });
1298bc03f14fSopenharmony_ci  });
1299bc03f14fSopenharmony_ci
1300bc03f14fSopenharmony_ci  /**
1301bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test48
1302bc03f14fSopenharmony_ci   * @tc.desc      关闭内容变化通知功能:向剪贴板数据增加、删除等html数据项
1303bc03f14fSopenharmony_ci   * @tc.type      Function
1304bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1305bc03f14fSopenharmony_ci   */
1306bc03f14fSopenharmony_ci  it('pasteboard_promise_test48', 0, async function (done) {
1307bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1308bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1309bc03f14fSopenharmony_ci    systemPasteboard.off('update', contentChanges);
1310bc03f14fSopenharmony_ci    const htmlText48 = '<html><head></head><body>Hello World!</body></html>';
1311bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText48);
1312bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1313bc03f14fSopenharmony_ci    const res48 = await systemPasteboard.hasPasteData();
1314bc03f14fSopenharmony_ci    expect(res48).assertEqual(true);
1315bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1316bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(1);
1317bc03f14fSopenharmony_ci      expect(data.removeRecordAt(0)).assertEqual(true);
1318bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(0);
1319bc03f14fSopenharmony_ci      done();
1320bc03f14fSopenharmony_ci    });
1321bc03f14fSopenharmony_ci  });
1322bc03f14fSopenharmony_ci
1323bc03f14fSopenharmony_ci  /**
1324bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test49
1325bc03f14fSopenharmony_ci   * @tc.desc      创建pixelMap
1326bc03f14fSopenharmony_ci   * @tc.type      Function
1327bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1328bc03f14fSopenharmony_ci   */
1329bc03f14fSopenharmony_ci  it('pasteboard_promise_test49', 0, async function (done) {
1330bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1331bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1332bc03f14fSopenharmony_ci    const buffer49 = new ArrayBuffer(128);
1333bc03f14fSopenharmony_ci    const opt49 = {
1334bc03f14fSopenharmony_ci      size: { height: 5, width: 5 },
1335bc03f14fSopenharmony_ci      pixelFormat: 3,
1336bc03f14fSopenharmony_ci      editable: true,
1337bc03f14fSopenharmony_ci      alphaType: 1,
1338bc03f14fSopenharmony_ci      scaleMode: 1,
1339bc03f14fSopenharmony_ci    };
1340bc03f14fSopenharmony_ci    const pixelMap = await image.createPixelMap(buffer49, opt49);
1341bc03f14fSopenharmony_ci    expect(pixelMap.getPixelBytesNumber()).assertEqual(100);
1342bc03f14fSopenharmony_ci    const pasteData49 = pasteboard.createData(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
1343bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData49);
1344bc03f14fSopenharmony_ci    const res49 = await systemPasteboard.hasPasteData();
1345bc03f14fSopenharmony_ci    expect(res49).assertEqual(true);
1346bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then(async (newPasteData) => {
1347bc03f14fSopenharmony_ci      const recordCount49 = newPasteData.getRecordCount();
1348bc03f14fSopenharmony_ci      expect(recordCount49).assertEqual(1);
1349bc03f14fSopenharmony_ci      const newPixelMap49 = newPasteData.getPrimaryPixelMap();
1350bc03f14fSopenharmony_ci      const PixelMapBytesNumber = newPixelMap49.getPixelBytesNumber();
1351bc03f14fSopenharmony_ci      expect(PixelMapBytesNumber).assertEqual(100);
1352bc03f14fSopenharmony_ci      const imageInfo = await newPixelMap49.getImageInfo();
1353bc03f14fSopenharmony_ci      expect(imageInfo.size.height === 5 && imageInfo.size.width === 5).assertEqual(true);
1354bc03f14fSopenharmony_ci      done();
1355bc03f14fSopenharmony_ci    });
1356bc03f14fSopenharmony_ci  });
1357bc03f14fSopenharmony_ci
1358bc03f14fSopenharmony_ci  /**
1359bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test50
1360bc03f14fSopenharmony_ci   * @tc.desc      创建kv Record
1361bc03f14fSopenharmony_ci   * @tc.type      Function
1362bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1363bc03f14fSopenharmony_ci   */
1364bc03f14fSopenharmony_ci  it('pasteboard_promise_test50', 0, async function (done) {
1365bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1366bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1367bc03f14fSopenharmony_ci    const dataXml50 = new ArrayBuffer(512);
1368bc03f14fSopenharmony_ci    let int32view50 = new Int32Array(dataXml50);
1369bc03f14fSopenharmony_ci    for (let i = 0; i < int32view50.length; i++) {
1370bc03f14fSopenharmony_ci      int32view50[i] = 65535 + i;
1371bc03f14fSopenharmony_ci    }
1372bc03f14fSopenharmony_ci    const pasteDataRecord = pasteboard.createRecord('app/xml', dataXml50);
1373bc03f14fSopenharmony_ci    const dataJpg50 = new ArrayBuffer(256);
1374bc03f14fSopenharmony_ci    pasteDataRecord.data['image/ipg'] = dataJpg50;
1375bc03f14fSopenharmony_ci    const pasteData50 = pasteboard.createHtmlData('application/xml');
1376bc03f14fSopenharmony_ci    const replace = pasteData50.replaceRecordAt(0, pasteDataRecord);
1377bc03f14fSopenharmony_ci    expect(replace).assertEqual(true);
1378bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData50);
1379bc03f14fSopenharmony_ci    const res50 = await systemPasteboard.hasPasteData();
1380bc03f14fSopenharmony_ci    expect(res50).assertEqual(true);
1381bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((newPasteData) => {
1382bc03f14fSopenharmony_ci      const recordCount50 = newPasteData.getRecordCount();
1383bc03f14fSopenharmony_ci      expect(recordCount50).assertEqual(1);
1384bc03f14fSopenharmony_ci      let newPasteDataRecord = newPasteData.getRecordAt(0);
1385bc03f14fSopenharmony_ci      let newAppXml50 = newPasteDataRecord.data['app/xml'];
1386bc03f14fSopenharmony_ci      let newImageIpg50 = newPasteDataRecord.data['image/ipg'];
1387bc03f14fSopenharmony_ci      expect(newAppXml50.byteLength === 512 && newImageIpg50.byteLength === 256).assertEqual(true);
1388bc03f14fSopenharmony_ci      let newAppXmlView50 = new Int32Array(newAppXml50);
1389bc03f14fSopenharmony_ci      let newImageIpgView50 = new Int32Array(newImageIpg50);
1390bc03f14fSopenharmony_ci      for (let i = 0; i < newAppXmlView50.length; i++) {
1391bc03f14fSopenharmony_ci        console.info('newAppXml[' + i + '] = ' + newAppXmlView50[i]);
1392bc03f14fSopenharmony_ci      }
1393bc03f14fSopenharmony_ci      for (let i = 0; i < newImageIpgView50.length; i++) {
1394bc03f14fSopenharmony_ci        console.info('newImageIpg[' + i + '] = ' + newImageIpg50[i]);
1395bc03f14fSopenharmony_ci      }
1396bc03f14fSopenharmony_ci      done();
1397bc03f14fSopenharmony_ci    });
1398bc03f14fSopenharmony_ci  });
1399bc03f14fSopenharmony_ci
1400bc03f14fSopenharmony_ci  /**
1401bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test51
1402bc03f14fSopenharmony_ci   * @tc.desc      测试addPixelMapRecord
1403bc03f14fSopenharmony_ci   * @tc.type      Function
1404bc03f14fSopenharmony_ci   * @tc.require   AR000HEECD
1405bc03f14fSopenharmony_ci   */
1406bc03f14fSopenharmony_ci  it('pasteboard_promise_test51', 0, async function (done) {
1407bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1408bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1409bc03f14fSopenharmony_ci    const buffer51 = new ArrayBuffer(128);
1410bc03f14fSopenharmony_ci    const opt51 = {
1411bc03f14fSopenharmony_ci      size: { height: 5, width: 5 },
1412bc03f14fSopenharmony_ci      pixelFormat: 3,
1413bc03f14fSopenharmony_ci      editable: true,
1414bc03f14fSopenharmony_ci      alphaType: 1,
1415bc03f14fSopenharmony_ci      scaleMode: 1,
1416bc03f14fSopenharmony_ci    };
1417bc03f14fSopenharmony_ci    const pasteData51 = pasteboard.createHtmlData('application/xml');
1418bc03f14fSopenharmony_ci    const pixelMap = await image.createPixelMap(buffer51, opt51);
1419bc03f14fSopenharmony_ci    expect(pixelMap.getPixelBytesNumber() === 100).assertEqual(true);
1420bc03f14fSopenharmony_ci    pasteData51.addRecord(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
1421bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData51);
1422bc03f14fSopenharmony_ci    const res51 = await systemPasteboard.hasPasteData();
1423bc03f14fSopenharmony_ci    expect(res51).assertEqual(true);
1424bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then(async (newPasteData) => {
1425bc03f14fSopenharmony_ci      const recordCount51 = newPasteData.getRecordCount();
1426bc03f14fSopenharmony_ci      expect(recordCount51).assertEqual(2);
1427bc03f14fSopenharmony_ci      const newPixelMap51 = newPasteData.getPrimaryPixelMap();
1428bc03f14fSopenharmony_ci      const PixelMapBytesNumber51 = newPixelMap51.getPixelBytesNumber();
1429bc03f14fSopenharmony_ci      expect(PixelMapBytesNumber51).assertEqual(100);
1430bc03f14fSopenharmony_ci      const newHtmlData51 = newPasteData.getRecordAt(1);
1431bc03f14fSopenharmony_ci      expect(newHtmlData51.htmlText).assertEqual('application/xml');
1432bc03f14fSopenharmony_ci      const imageInfo51 = await newPixelMap51.getImageInfo();
1433bc03f14fSopenharmony_ci      expect(imageInfo51.size.height === 5 && imageInfo51.size.width === 5).assertEqual(true);
1434bc03f14fSopenharmony_ci      done();
1435bc03f14fSopenharmony_ci    });
1436bc03f14fSopenharmony_ci  });
1437bc03f14fSopenharmony_ci
1438bc03f14fSopenharmony_ci  /**
1439bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test52
1440bc03f14fSopenharmony_ci   * @tc.desc      支持512个record
1441bc03f14fSopenharmony_ci   * @tc.type      Function
1442bc03f14fSopenharmony_ci   * @tc.require   AR000HEECB
1443bc03f14fSopenharmony_ci   */
1444bc03f14fSopenharmony_ci  it('pasteboard_promise_test52', 0, async function (done) {
1445bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1446bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1447bc03f14fSopenharmony_ci    const dataHtml52 = new ArrayBuffer(256);
1448bc03f14fSopenharmony_ci    const htmlText52 = '<html><head></head><body>Hello!</body></html>';
1449bc03f14fSopenharmony_ci    const uriText52 = 'https://www.baidu.com/';
1450bc03f14fSopenharmony_ci    const wantText52 = {
1451bc03f14fSopenharmony_ci      bundleName: 'com.example.myapplication3',
1452bc03f14fSopenharmony_ci      abilityName: 'com.example.myapplication3.MainAbility',
1453bc03f14fSopenharmony_ci    };
1454bc03f14fSopenharmony_ci    const plainText52 = '';
1455bc03f14fSopenharmony_ci    const pasteData52 = pasteboard.createData('x'.repeat(1024), dataHtml52);
1456bc03f14fSopenharmony_ci    const record52 = pasteData52.getRecordAt(0);
1457bc03f14fSopenharmony_ci    record52.htmlText = htmlText52;
1458bc03f14fSopenharmony_ci    record52.plainText = plainText52;
1459bc03f14fSopenharmony_ci    record52.uri = uriText52;
1460bc03f14fSopenharmony_ci    record52.want = wantText52;
1461bc03f14fSopenharmony_ci    const buffer52 = new ArrayBuffer(128);
1462bc03f14fSopenharmony_ci    const opt52 = {
1463bc03f14fSopenharmony_ci      size: { height: 5, width: 5 },
1464bc03f14fSopenharmony_ci      pixelFormat: 3,
1465bc03f14fSopenharmony_ci      editable: true,
1466bc03f14fSopenharmony_ci      alphaType: 1,
1467bc03f14fSopenharmony_ci      scaleMode: 1,
1468bc03f14fSopenharmony_ci    };
1469bc03f14fSopenharmony_ci    const pixelMap = await image.createPixelMap(buffer52, opt52);
1470bc03f14fSopenharmony_ci    record52.pixelMap = pixelMap;
1471bc03f14fSopenharmony_ci    pasteData52.replaceRecordAt(0, record52);
1472bc03f14fSopenharmony_ci    for (let i = 0; i < 511; i++) {
1473bc03f14fSopenharmony_ci      pasteData52.addRecord(record52);
1474bc03f14fSopenharmony_ci    }
1475bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData52);
1476bc03f14fSopenharmony_ci    const res52 = await systemPasteboard.hasPasteData();
1477bc03f14fSopenharmony_ci    expect(res52).assertTrue();
1478bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1479bc03f14fSopenharmony_ci      expect(data.getRecordCount()).assertEqual(512);
1480bc03f14fSopenharmony_ci      expect(data.getRecordAt(0).mimeType).assertEqual('x'.repeat(1024));
1481bc03f14fSopenharmony_ci      expect(data.getPrimaryWant().bundleName).assertEqual(wantText52.bundleName);
1482bc03f14fSopenharmony_ci      expect(data.getRecordAt(253).htmlText).assertEqual(htmlText52);
1483bc03f14fSopenharmony_ci      expect(data.getRecordAt(511).plainText).assertEqual(plainText52);
1484bc03f14fSopenharmony_ci      done();
1485bc03f14fSopenharmony_ci    });
1486bc03f14fSopenharmony_ci  });
1487bc03f14fSopenharmony_ci
1488bc03f14fSopenharmony_ci  /**
1489bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test53
1490bc03f14fSopenharmony_ci   * @tc.desc      html
1491bc03f14fSopenharmony_ci   * @tc.type      Function
1492bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
1493bc03f14fSopenharmony_ci   */
1494bc03f14fSopenharmony_ci  it('pasteboard_promise_test53', 0, async function (done) {
1495bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1496bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1497bc03f14fSopenharmony_ci    const textData = "<!DOCTYPE html><html><head><title>" +
1498bc03f14fSopenharmony_ci    "的厚爱hi哦</title></head><body><h2>恶风无关痛痒和</h2>" +
1499bc03f14fSopenharmony_ci    "<p>Greg任何人https://exampsaole.com问我的<a href=\"https://exaeqdwerfmple.com\">" +
1500bc03f14fSopenharmony_ci    "如果qwiuyhw@huedqw.dsh站</a>。</p></body></html>";
1501bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(textData);
1502bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1503bc03f14fSopenharmony_ci    const res = await systemPasteboard.hasPasteData();
1504bc03f14fSopenharmony_ci    expect(res).assertEqual(true);
1505bc03f14fSopenharmony_ci    const patterns = [pasteboard.Pattern.EMAIL_ADDRESS, pasteboard.Pattern.NUMBER];
1506bc03f14fSopenharmony_ci    systemPasteboard.detectPatterns(patterns).then((data) => {
1507bc03f14fSopenharmony_ci      const patternsRight = [pasteboard.Pattern.EMAIL_ADDRESS];
1508bc03f14fSopenharmony_ci      expect(data.sort().join('')).assertEqual(patternsRight.sort().join(''));
1509bc03f14fSopenharmony_ci      done();
1510bc03f14fSopenharmony_ci    }).catch((error)=>{
1511bc03f14fSopenharmony_ci      console.error('promise_test53: systemPasteboard.detectPatterns promise error:' + error.message);
1512bc03f14fSopenharmony_ci      return;
1513bc03f14fSopenharmony_ci    });
1514bc03f14fSopenharmony_ci  });
1515bc03f14fSopenharmony_ci
1516bc03f14fSopenharmony_ci  /**
1517bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test54
1518bc03f14fSopenharmony_ci   * @tc.desc      plaintext
1519bc03f14fSopenharmony_ci   * @tc.type      Function
1520bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
1521bc03f14fSopenharmony_ci   */
1522bc03f14fSopenharmony_ci  it('pasteboard_promise_test54', 0, async function (done) {
1523bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1524bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1525bc03f14fSopenharmony_ci    const textData = "部分人的十点半:\n" +
1526bc03f14fSopenharmony_ci    "「而飞过海」\n" +
1527bc03f14fSopenharmony_ci    "方法:\n" +
1528bc03f14fSopenharmony_ci    "https://pr5yyye-drseyive.u54yk.cwerfe/s/42e1ewed77f3dab4" +
1529bc03f14fSopenharmony_ci    "网gest加尔文iqru发的我ui哦计划任务i文化人:\n" +
1530bc03f14fSopenharmony_ci    "~b0043fg3423tddj~";
1531bc03f14fSopenharmony_ci    const pasteData = pasteboard.createPlainTextData(textData);
1532bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1533bc03f14fSopenharmony_ci    const res = await systemPasteboard.hasPasteData();
1534bc03f14fSopenharmony_ci    expect(res).assertEqual(true);
1535bc03f14fSopenharmony_ci    const patterns = [pasteboard.Pattern.EMAIL_ADDRESS,
1536bc03f14fSopenharmony_ci      pasteboard.Pattern.URL, pasteboard.Pattern.NUMBER];
1537bc03f14fSopenharmony_ci    systemPasteboard.detectPatterns(patterns).then((data) => {
1538bc03f14fSopenharmony_ci      const patternsRight = [pasteboard.Pattern.NUMBER, pasteboard.Pattern.URL];
1539bc03f14fSopenharmony_ci      expect(data.sort().join('')).assertEqual(patternsRight.sort().join(''));
1540bc03f14fSopenharmony_ci      done();
1541bc03f14fSopenharmony_ci    }).catch((error)=>{
1542bc03f14fSopenharmony_ci      console.error('promise_test54: systemPasteboard.detectPatterns promise error:' + error.message);
1543bc03f14fSopenharmony_ci      return;
1544bc03f14fSopenharmony_ci    });
1545bc03f14fSopenharmony_ci  });
1546bc03f14fSopenharmony_ci
1547bc03f14fSopenharmony_ci  /**
1548bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test55
1549bc03f14fSopenharmony_ci   * @tc.desc      Add html with local uri
1550bc03f14fSopenharmony_ci   * @tc.type      Function
1551bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
1552bc03f14fSopenharmony_ci   */
1553bc03f14fSopenharmony_ci  it('pasteboard_promise_test55', 0, async function (done) {
1554bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1555bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1556bc03f14fSopenharmony_ci    const htmlText5 = "<html><head></head><body><div class='item'><img " +
1557bc03f14fSopenharmony_ci        "src='file:///com.example.webview/data/storage/el1/base/test.png'></div></body></html>";
1558bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText5);
1559bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1560bc03f14fSopenharmony_ci    const res5 = await systemPasteboard.hasPasteData();
1561bc03f14fSopenharmony_ci    expect(res5).assertEqual(true);
1562bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1563bc03f14fSopenharmony_ci      const pasteData5 = data;
1564bc03f14fSopenharmony_ci      expect(pasteData5.getRecordCount()).assertEqual(1);
1565bc03f14fSopenharmony_ci      const primaryHtml6 = pasteData5.getPrimaryHtml();
1566bc03f14fSopenharmony_ci      expect(primaryHtml6).assertEqual(htmlText5);
1567bc03f14fSopenharmony_ci      expect(pasteData5.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
1568bc03f14fSopenharmony_ci      expect(pasteData5.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
1569bc03f14fSopenharmony_ci      done();
1570bc03f14fSopenharmony_ci    });
1571bc03f14fSopenharmony_ci  });
1572bc03f14fSopenharmony_ci
1573bc03f14fSopenharmony_ci  /**
1574bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test56
1575bc03f14fSopenharmony_ci   * @tc.desc      Add html with distributed uri
1576bc03f14fSopenharmony_ci   * @tc.type      Function
1577bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
1578bc03f14fSopenharmony_ci   */
1579bc03f14fSopenharmony_ci  it('pasteboard_promise_test56', 0, async function (done) {
1580bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1581bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1582bc03f14fSopenharmony_ci    const htmlText5 = "<html><head></head><body><div class='item'><img src='file://com.byy.testdpb/data/storage/el2/" +
1583bc03f14fSopenharmony_ci        "distributedfiles/.remote_share/data/storage/el2/base/haps/entry/cache/t1.jpg'></div></body></html>";
1584bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText5);
1585bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1586bc03f14fSopenharmony_ci    const res5 = await systemPasteboard.hasPasteData();
1587bc03f14fSopenharmony_ci    expect(res5).assertEqual(true);
1588bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1589bc03f14fSopenharmony_ci      const pasteData5 = data;
1590bc03f14fSopenharmony_ci      expect(pasteData5.getRecordCount()).assertEqual(1);
1591bc03f14fSopenharmony_ci      const primaryHtml6 = pasteData5.getPrimaryHtml();
1592bc03f14fSopenharmony_ci      expect(primaryHtml6).assertEqual(htmlText5);
1593bc03f14fSopenharmony_ci      expect(pasteData5.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
1594bc03f14fSopenharmony_ci      expect(pasteData5.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
1595bc03f14fSopenharmony_ci      done();
1596bc03f14fSopenharmony_ci    });
1597bc03f14fSopenharmony_ci  });
1598bc03f14fSopenharmony_ci
1599bc03f14fSopenharmony_ci  /**
1600bc03f14fSopenharmony_ci   * @tc.name      pasteboard_promise_test57
1601bc03f14fSopenharmony_ci   * @tc.desc      Add html with uris
1602bc03f14fSopenharmony_ci   * @tc.type      Function
1603bc03f14fSopenharmony_ci   * @tc.require   AR000H5HVI
1604bc03f14fSopenharmony_ci   */
1605bc03f14fSopenharmony_ci  it('pasteboard_promise_test57', 0, async function (done) {
1606bc03f14fSopenharmony_ci    const systemPasteboard = pasteboard.getSystemPasteboard();
1607bc03f14fSopenharmony_ci    await systemPasteboard.clearData();
1608bc03f14fSopenharmony_ci    const htmlText5 = "<html><head></head><body><div class='item'><img src='file://com.byy.testdpb/data/storage/el2/" +
1609bc03f14fSopenharmony_ci        "distributedfiles/.remote_share/data/storage/el2/base/haps/entry/cache/t1.jpg'></div>" +
1610bc03f14fSopenharmony_ci        "<div class='item'><img src='file:///com.example.webview/data/storage/el1/base/test.png'></div></body></html>";
1611bc03f14fSopenharmony_ci    const pasteData = pasteboard.createHtmlData(htmlText5);
1612bc03f14fSopenharmony_ci    await systemPasteboard.setPasteData(pasteData);
1613bc03f14fSopenharmony_ci    const res5 = await systemPasteboard.hasPasteData();
1614bc03f14fSopenharmony_ci    expect(res5).assertEqual(true);
1615bc03f14fSopenharmony_ci    systemPasteboard.getPasteData().then((data) => {
1616bc03f14fSopenharmony_ci      const pasteData5 = data;
1617bc03f14fSopenharmony_ci      expect(pasteData5.getRecordCount()).assertEqual(1);
1618bc03f14fSopenharmony_ci      const primaryHtml6 = pasteData5.getPrimaryHtml();
1619bc03f14fSopenharmony_ci      expect(primaryHtml6).assertEqual(htmlText5);
1620bc03f14fSopenharmony_ci      expect(pasteData5.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML)).assertEqual(true);
1621bc03f14fSopenharmony_ci      expect(pasteData5.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML);
1622bc03f14fSopenharmony_ci      done();
1623bc03f14fSopenharmony_ci    });
1624bc03f14fSopenharmony_ci  });
1625bc03f14fSopenharmony_ci
1626bc03f14fSopenharmony_ci  /**
1627bc03f14fSopenharmony_ci   *  The callback function is used for pasteboard content changes
1628bc03f14fSopenharmony_ci   */
1629bc03f14fSopenharmony_ci  function contentChanges() {
1630bc03f14fSopenharmony_ci    console.info('#EVENT: The content is changed in the pasteboard');
1631bc03f14fSopenharmony_ci  }
1632bc03f14fSopenharmony_ci});