1/* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the 'License'); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an 'AS IS' BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; 17import pasteboard from '@ohos.pasteboard'; 18import UDC from '@ohos.data.unifiedDataChannel'; 19import UTD from '@ohos.data.uniformTypeDescriptor' 20import image from '@ohos.multimedia.image'; 21 22const KEY_TEST_ELEMENT = 'TestKey'; 23const VALUE_TEST_ELEMENT = 'TestValue'; 24const TEST_BUNDLE_NAME = 'MyBundleName'; 25const TEST_ID = 123456; 26const TEST_ABILITY_NAME = 'MyAbilityName'; 27 28let U8_ARRAY = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); 29 30var textData = new UDC.UnifiedData(); 31var plainTextData = new UDC.UnifiedData(); 32var hyperlinkData = new UDC.UnifiedData(); 33var htmlData = new UDC.UnifiedData(); 34var fileData = new UDC.UnifiedData(); 35var folderData = new UDC.UnifiedData(); 36var imageData = new UDC.UnifiedData(); 37var videoData = new UDC.UnifiedData(); 38var audioData = new UDC.UnifiedData(); 39var systemDefinedFormData = new UDC.UnifiedData(); 40var systemDefinedAppItemData = new UDC.UnifiedData(); 41var applicationDefinedRecordData = new UDC.UnifiedData(); 42var wantData = new UDC.UnifiedData(); 43var pixelMapData = new UDC.UnifiedData(); 44 45describe('PasteBoardUnifiedDataSyncJSTest', function () { 46 beforeAll(async function () { 47 console.info('beforeAll'); 48 }); 49 50 afterAll(async function () { 51 console.info('afterAll'); 52 }); 53 54 beforeEach(async function () { 55 console.info('beforeEach'); 56 const systemPasteboard = pasteboard.getSystemPasteboard(); 57 await systemPasteboard.clearData(); 58 }); 59 60 afterEach(async function () { 61 console.info('afterEach'); 62 }); 63 64 function getTextData() { 65 let text = new UDC.Text(); 66 text.details = { 67 Key: 'text' + KEY_TEST_ELEMENT, 68 Value: 'text' + VALUE_TEST_ELEMENT, 69 }; 70 textData.addRecord(text); 71 return textData; 72 } 73 74 function getPlainTextData() { 75 let plainText = new UDC.PlainText(); 76 plainText.details = { 77 Key: 'plainText' + KEY_TEST_ELEMENT, 78 Value: 'plainText' + VALUE_TEST_ELEMENT, 79 }; 80 plainText.textContent = 'textContent'; 81 plainText.abstract = 'abstract'; 82 plainTextData.addRecord(plainText); 83 return plainTextData; 84 } 85 86 function getHyperlinkData() { 87 let link = new UDC.Hyperlink(); 88 link.details = { 89 Key: 'hyperLink' + KEY_TEST_ELEMENT, 90 Value: 'hyperLink' + VALUE_TEST_ELEMENT, 91 }; 92 link.url = 'url'; 93 link.description = 'description'; 94 hyperlinkData.addRecord(link); 95 return hyperlinkData; 96 } 97 98 function getHtmlData() { 99 let html = new UDC.HTML(); 100 html.details = { 101 Key: 'html' + KEY_TEST_ELEMENT, 102 Value: 'html' + VALUE_TEST_ELEMENT, 103 }; 104 html.htmlContent = 'htmlContent'; 105 html.plainContent = 'plainContent'; 106 htmlData.addRecord(html); 107 return htmlData; 108 } 109 110 function getFileData() { 111 let file = new UDC.File(); 112 file.details = { 113 Key: 'file' + KEY_TEST_ELEMENT, 114 Value: 'file' + VALUE_TEST_ELEMENT, 115 }; 116 file.uri = 'uri'; 117 fileData.addRecord(file); 118 return fileData; 119 } 120 121 function getFolderData() { 122 let folder = new UDC.Folder(); 123 folder.details = { 124 Key: 'folder' + KEY_TEST_ELEMENT, 125 Value: 'folder' + VALUE_TEST_ELEMENT, 126 }; 127 folder.uri = 'folderUri'; 128 folderData.addRecord(folder); 129 return folderData; 130 } 131 132 function getImageData() { 133 let image = new UDC.Image(); 134 image.details = { 135 Key: 'image' + KEY_TEST_ELEMENT, 136 Value: 'image' + VALUE_TEST_ELEMENT, 137 }; 138 image.imageUri = 'imageUri'; 139 imageData.addRecord(image); 140 return imageData; 141 } 142 143 function getVideoData() { 144 let video = new UDC.Video(); 145 video.details = { 146 Key: 'video' + KEY_TEST_ELEMENT, 147 Value: 'video' + VALUE_TEST_ELEMENT, 148 }; 149 video.videoUri = 'videoUri'; 150 videoData.addRecord(video); 151 return videoData; 152 } 153 154 function getAudioData() { 155 let audio = new UDC.Audio(); 156 audio.details = { 157 Key: 'audio' + KEY_TEST_ELEMENT, 158 Value: 'audio' + VALUE_TEST_ELEMENT, 159 }; 160 audio.audioUri = 'audioUri'; 161 audioData.addRecord(audio); 162 return audioData; 163 } 164 165 function getSystemDefinedAppItemDataData() { 166 let appItem = new UDC.SystemDefinedAppItem(); 167 appItem.appId = 'MyAppId'; 168 appItem.appName = 'MyAppName'; 169 appItem.abilityName = TEST_ABILITY_NAME; 170 appItem.bundleName = TEST_BUNDLE_NAME; 171 appItem.appIconId = 'MyAppIconId'; 172 appItem.appLabelId = 'MyAppLabelId'; 173 appItem.details = { 174 appItemKey1: 1, 175 appItemKey2: 'appItem' + VALUE_TEST_ELEMENT, 176 appItemKey3: U8_ARRAY, 177 }; 178 systemDefinedAppItemData.addRecord(appItem); 179 return systemDefinedAppItemData; 180 } 181 182 function getApplicationDefinedRecordData() { 183 let applicationDefinedRecord = new UDC.ApplicationDefinedRecord(); 184 applicationDefinedRecord.applicationDefinedType = 'applicationDefinedType'; 185 applicationDefinedRecord.rawData = U8_ARRAY; 186 applicationDefinedRecordData.addRecord(applicationDefinedRecord); 187 return applicationDefinedRecordData; 188 } 189 190 function getWantData() { 191 let object = { 192 bundleName: 'bundleName', 193 abilityName: 'abilityName' 194 } 195 let wantRecord = new UDC.UnifiedRecord(UTD.UniformDataType.OPENHARMONY_WANT, object); 196 wantData.addRecord(wantRecord); 197 return wantData; 198 } 199 200 function getPixelMapData() { 201 const buffer = new ArrayBuffer(128); 202 const opt = { 203 size: { height: 5, width: 5 }, 204 pixelFormat: 3, 205 editable: true, 206 alphaType: 1, 207 scaleMode: 1, 208 }; 209 const pixelMap = image.createPixelMapSync(buffer, opt); 210 let pixelMapRecord = new UDC.UnifiedRecord(UTD.UniformDataType.OPENHARMONY_PIXEL_MAP, pixelMap); 211 pixelMapData.addRecord(pixelMapRecord); 212 return pixelMapData; 213 } 214 215 /** 216 * @tc.name TextTestSync001 217 * @tc.desc Test Unified Record of Text 218 * @tc.type FUNC 219 */ 220 it('TextTestSync001', 0, async function (done) { 221 getTextData(); 222 const systemPasteboard = pasteboard.getSystemPasteboard(); 223 systemPasteboard.setUnifiedDataSync(textData); 224 const flag = await systemPasteboard.hasPasteData(); 225 expect(flag).assertEqual(true); 226 const outputData = systemPasteboard.getUnifiedDataSync(); 227 let records = outputData.getRecords(); 228 expect(records.length).assertEqual(1); 229 expect(records[0].details.Key).assertEqual('text' + KEY_TEST_ELEMENT); 230 expect(records[0].details.Value).assertEqual('text' + VALUE_TEST_ELEMENT); 231 232 systemPasteboard.getData().then((data) => { 233 const outputData = data; 234 expect(outputData.getRecordCount()).assertEqual(1); 235 expect(outputData.getPrimaryMimeType()).assertEqual('general.text'); 236 done(); 237 }); 238 console.info('TextTestSync001 end'); 239 }); 240 241 /** 242 * @tc.name PlainTextTestSync001 243 * @tc.desc Test Unified Record of Plain Text 244 * @tc.type FUNC 245 */ 246 it('PlainTextTestSync001', 0, async function (done) { 247 console.info('PlainTextTestSync001 begin'); 248 getPlainTextData(); 249 const systemPasteboard = pasteboard.getSystemPasteboard(); 250 systemPasteboard.setUnifiedDataSync(plainTextData); 251 const flag = await systemPasteboard.hasPasteData(); 252 expect(flag).assertEqual(true); 253 const outputData = systemPasteboard.getUnifiedDataSync(); 254 let records = outputData.getRecords(); 255 expect(records.length).assertEqual(1); 256 expect(records[0].details.Key).assertEqual('plainText' + KEY_TEST_ELEMENT); 257 expect(records[0].details.Value).assertEqual('plainText' + VALUE_TEST_ELEMENT); 258 expect(records[0].textContent).assertEqual('textContent'); 259 expect(records[0].abstract).assertEqual('abstract'); 260 261 systemPasteboard.getData().then((data) => { 262 const outputData = data; 263 expect(outputData.getRecordCount()).assertEqual(1); 264 expect(outputData.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN); 265 const primaryText = outputData.getPrimaryText(); 266 expect(primaryText).assertEqual('textContent'); 267 done(); 268 }); 269 console.info('PlainTextTestSync001 end'); 270 }); 271 272 /** 273 * @tc.name HyperlinkTestSync001 274 * @tc.desc Test Unified Record of Hyper Link 275 * @tc.type FUNC 276 */ 277 it('HyperlinkTestSync001', 0, async function (done) { 278 getHyperlinkData(); 279 const systemPasteboard = pasteboard.getSystemPasteboard(); 280 systemPasteboard.setUnifiedDataSync(hyperlinkData); 281 const flag = await systemPasteboard.hasPasteData(); 282 expect(flag).assertEqual(true); 283 const outputData = systemPasteboard.getUnifiedDataSync(); 284 let records = outputData.getRecords(); 285 expect(records.length).assertEqual(1); 286 expect(records[0].details.Key).assertEqual('hyperLink' + KEY_TEST_ELEMENT); 287 expect(records[0].details.Value).assertEqual('hyperLink' + VALUE_TEST_ELEMENT); 288 expect(records[0].url).assertEqual('url'); 289 expect(records[0].description).assertEqual('description'); 290 291 systemPasteboard.getData().then((data) => { 292 const outputData = data; 293 expect(outputData.getRecordCount()).assertEqual(1); 294 expect(outputData.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_PLAIN); 295 const primaryText = outputData.getPrimaryText(); 296 expect(primaryText).assertEqual('url'); 297 done(); 298 }); 299 console.info('HyperlinkTestSync001 end'); 300 }); 301 302 /** 303 * @tc.name HtmlTestSync001 304 * @tc.desc Test Unified Record of Html 305 * @tc.type FUNC 306 */ 307 it('HtmlTestSync001', 0, async function (done) { 308 getHtmlData(); 309 const systemPasteboard = pasteboard.getSystemPasteboard(); 310 systemPasteboard.setUnifiedDataSync(htmlData); 311 const flag = await systemPasteboard.hasPasteData(); 312 expect(flag).assertEqual(true); 313 const outputData = systemPasteboard.getUnifiedDataSync(); 314 let records = outputData.getRecords(); 315 expect(records.length).assertEqual(1); 316 expect(records[0].details.Key).assertEqual('html' + KEY_TEST_ELEMENT); 317 expect(records[0].details.Value).assertEqual('html' + VALUE_TEST_ELEMENT); 318 expect(records[0].htmlContent).assertEqual('htmlContent'); 319 expect(records[0].plainContent).assertEqual('plainContent'); 320 systemPasteboard.getData().then((data) => { 321 const outputData = data; 322 expect(outputData.getRecordCount()).assertEqual(1); 323 expect(outputData.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_HTML); 324 const primaryHtml = outputData.getPrimaryHtml(); 325 expect(primaryHtml).assertEqual('htmlContent'); 326 done(); 327 }); 328 console.info('HtmlTestSync001 end'); 329 }); 330 331 /** 332 * @tc.name FileTestSync001 333 * @tc.desc Test Unified Record of File 334 * @tc.type FUNC 335 */ 336 it('FileTestSync001', 0, async function (done) { 337 console.info('FileTestSync001 begin'); 338 getFileData(); 339 const systemPasteboard = pasteboard.getSystemPasteboard(); 340 systemPasteboard.setUnifiedDataSync(fileData); 341 const flag = await systemPasteboard.hasPasteData(); 342 expect(flag).assertEqual(true); 343 const outputData = systemPasteboard.getUnifiedDataSync(); 344 let records = outputData.getRecords(); 345 expect(records.length).assertEqual(1); 346 expect(records[0].details.Key).assertEqual('file' + KEY_TEST_ELEMENT); 347 expect(records[0].details.Value).assertEqual('file' + VALUE_TEST_ELEMENT); 348 expect(records[0].uri).assertEqual('uri'); 349 350 systemPasteboard.getData().then((data) => { 351 const outputData = data; 352 expect(outputData.getRecordCount()).assertEqual(1); 353 expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true); 354 const primaryUri = data.getPrimaryUri(); 355 expect(primaryUri).assertEqual('uri'); 356 done(); 357 }); 358 console.info('FileTestSync001 end'); 359 }); 360 361 /** 362 * @tc.name FolderTestSync001 363 * @tc.desc Test Unified Record of Folder 364 * @tc.type FUNC 365 */ 366 it('FolderTestSync001', 0, async function (done) { 367 console.info('FolderTestSync001 begin'); 368 getFolderData(); 369 const systemPasteboard = pasteboard.getSystemPasteboard(); 370 systemPasteboard.setUnifiedDataSync(folderData); 371 const flag = await systemPasteboard.hasPasteData(); 372 expect(flag).assertEqual(true); 373 const outputData = systemPasteboard.getUnifiedDataSync(); 374 let records = outputData.getRecords(); 375 expect(records.length).assertEqual(1); 376 expect(records[0].details.Key).assertEqual('folder' + KEY_TEST_ELEMENT); 377 expect(records[0].details.Value).assertEqual('folder' + VALUE_TEST_ELEMENT); 378 expect(records[0].uri).assertEqual('folderUri'); 379 380 systemPasteboard.getData().then((data) => { 381 const outputData = data; 382 expect(outputData.getRecordCount()).assertEqual(1); 383 expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true); 384 const primaryUri = data.getPrimaryUri(); 385 expect(primaryUri).assertEqual('folderUri'); 386 done(); 387 }); 388 console.info('FolderTestSync001 end'); 389 }); 390 391 /** 392 * @tc.name ImageTestSync001 393 * @tc.desc Test Unified Record of Image 394 * @tc.type FUNC 395 */ 396 it('ImageTestSync001', 0, async function (done) { 397 console.info('ImageTestSync001 begin'); 398 getImageData(); 399 const systemPasteboard = pasteboard.getSystemPasteboard(); 400 systemPasteboard.setUnifiedDataSync(imageData); 401 const flag = await systemPasteboard.hasPasteData(); 402 expect(flag).assertEqual(true); 403 const outputData = systemPasteboard.getUnifiedDataSync(); 404 let records = outputData.getRecords(); 405 expect(records.length).assertEqual(1); 406 expect(records[0].details.Key).assertEqual('image' + KEY_TEST_ELEMENT); 407 expect(records[0].details.Value).assertEqual('image' + VALUE_TEST_ELEMENT); 408 expect(records[0].imageUri).assertEqual('imageUri'); 409 410 systemPasteboard.getData().then((data) => { 411 const outputData = data; 412 expect(outputData.getRecordCount()).assertEqual(1); 413 expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true); 414 const primaryUri = data.getPrimaryUri(); 415 expect(primaryUri).assertEqual('imageUri'); 416 done(); 417 }); 418 console.info('ImageTestSync001 end'); 419 }); 420 421 /** 422 * @tc.name VideoTestSync001 423 * @tc.desc Test Unified Record of Video 424 * @tc.type FUNC 425 */ 426 it('VideoTestSync001', 0, async function (done) { 427 console.info('VideoTestSync001 begin'); 428 getVideoData(); 429 const systemPasteboard = pasteboard.getSystemPasteboard(); 430 systemPasteboard.setUnifiedDataSync(videoData); 431 const flag = await systemPasteboard.hasPasteData(); 432 expect(flag).assertEqual(true); 433 const outputData = systemPasteboard.getUnifiedDataSync(); 434 let records = outputData.getRecords(); 435 expect(records.length).assertEqual(1); 436 expect(records[0].details.Key).assertEqual('video' + KEY_TEST_ELEMENT); 437 expect(records[0].details.Value).assertEqual('video' + VALUE_TEST_ELEMENT); 438 expect(records[0].videoUri).assertEqual('videoUri'); 439 440 systemPasteboard.getData().then((data) => { 441 const outputData = data; 442 expect(outputData.getRecordCount()).assertEqual(1); 443 expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true); 444 const primaryUri = data.getPrimaryUri(); 445 expect(primaryUri).assertEqual('videoUri'); 446 done(); 447 }); 448 console.info('VideoTestSync001 end'); 449 }); 450 451 /** 452 * @tc.name AudioTestSync001 453 * @tc.desc Test Unified Record of Audio 454 * @tc.type FUNC 455 */ 456 it('AudioTestSync001', 0, async function (done) { 457 console.info('AudioTestSync001 begin'); 458 getAudioData(); 459 const systemPasteboard = pasteboard.getSystemPasteboard(); 460 systemPasteboard.setUnifiedDataSync(audioData); 461 const flag = await systemPasteboard.hasPasteData(); 462 expect(flag).assertEqual(true); 463 const outputData = systemPasteboard.getUnifiedDataSync(); 464 let records = outputData.getRecords(); 465 expect(records.length).assertEqual(1); 466 expect(records[0].details.Key).assertEqual('audio' + KEY_TEST_ELEMENT); 467 expect(records[0].details.Value).assertEqual('audio' + VALUE_TEST_ELEMENT); 468 expect(records[0].audioUri).assertEqual('audioUri'); 469 470 systemPasteboard.getData().then((data) => { 471 const outputData = data; 472 expect(outputData.getRecordCount()).assertEqual(1); 473 expect(data.hasMimeType(pasteboard.MIMETYPE_TEXT_URI)).assertEqual(true); 474 const primaryUri = data.getPrimaryUri(); 475 expect(primaryUri).assertEqual('audioUri'); 476 done(); 477 }); 478 console.info('AudioTestSync001 end'); 479 }); 480 481 /** 482 * @tc.name SystemDefinedAppItemTestSync001 483 * @tc.desc Test Unified Record of SystemDefinedAppItem 484 * @tc.type FUNC 485 */ 486 it('SystemDefinedAppItemTestSync001', 0, async function (done) { 487 console.info('SystemDefinedAppItemTestSync001 begin'); 488 getSystemDefinedAppItemDataData(); 489 const systemPasteboard = pasteboard.getSystemPasteboard(); 490 systemPasteboard.setUnifiedDataSync(systemDefinedAppItemData); 491 const flag = await systemPasteboard.hasPasteData(); 492 expect(flag).assertEqual(true); 493 const outputData = systemPasteboard.getUnifiedDataSync(); 494 let records = outputData.getRecords(); 495 expect(records.length).assertEqual(1); 496 expect(records[0].details.appItemKey1).assertEqual(1); 497 expect(records[0].details.appItemKey2).assertEqual('appItem' + VALUE_TEST_ELEMENT); 498 for (let i = 0; i < U8_ARRAY.length; i++) { 499 expect(records[0].details.appItemKey3[i]).assertEqual(U8_ARRAY[i]); 500 } 501 expect(records[0].appId).assertEqual('MyAppId'); 502 expect(records[0].appName).assertEqual('MyAppName'); 503 expect(records[0].abilityName).assertEqual(TEST_ABILITY_NAME); 504 expect(records[0].bundleName).assertEqual(TEST_BUNDLE_NAME); 505 expect(records[0].appIconId).assertEqual('MyAppIconId'); 506 expect(records[0].appLabelId).assertEqual('MyAppLabelId'); 507 508 systemPasteboard.getData().then((data) => { 509 const outputData = data; 510 expect(outputData.getRecordCount()).assertEqual(1); 511 expect(outputData.getPrimaryMimeType()).assertEqual('openharmony.app-item'); 512 done(); 513 }); 514 console.info('SystemDefinedAppItemTestSync001 end'); 515 }); 516 517 /** 518 * @tc.name ApplicationDefinedRecordTestSync001 519 * @tc.desc Test Unified Record of ApplicationDefinedRecord 520 * @tc.type FUNC 521 */ 522 it('ApplicationDefinedRecordTestSync001', 0, async function (done) { 523 console.info('ApplicationDefinedRecordTestSync001 begin'); 524 getApplicationDefinedRecordData(); 525 const systemPasteboard = pasteboard.getSystemPasteboard(); 526 systemPasteboard.setUnifiedDataSync(applicationDefinedRecordData); 527 const flag = await systemPasteboard.hasPasteData(); 528 expect(flag).assertEqual(true); 529 const outputData = systemPasteboard.getUnifiedDataSync(); 530 let records = outputData.getRecords(); 531 expect(records.length).assertEqual(1); 532 expect(records[0].applicationDefinedType).assertEqual('applicationDefinedType'); 533 for (let i = 0; i < U8_ARRAY.length; i++) { 534 expect(records[0].rawData[i]).assertEqual(U8_ARRAY[i]); 535 } 536 systemPasteboard.getData().then((data) => { 537 const outputData = data; 538 expect(outputData.getRecordCount()).assertEqual(1); 539 expect(outputData.getPrimaryMimeType()).assertEqual('applicationDefinedType'); 540 done(); 541 }); 542 console.info('ApplicationDefinedRecordTestSync001 end'); 543 }); 544 545 /** 546 * @tc.name WantTestSync001 547 * @tc.desc Test Unified Record of Want 548 * @tc.type FUNC 549 */ 550 it('WantTestSync001', 0, async function (done) { 551 console.info('WantTestSync001 begin'); 552 getWantData(); 553 const systemPasteboard = pasteboard.getSystemPasteboard(); 554 systemPasteboard.setUnifiedDataSync(wantData); 555 const flag = await systemPasteboard.hasPasteData(); 556 expect(flag).assertEqual(true); 557 const outputData = systemPasteboard.getUnifiedDataSync(); 558 let records = outputData.getRecords(); 559 expect(records.length).assertEqual(1); 560 561 systemPasteboard.getData().then((data) => { 562 const outputData = data; 563 expect(outputData.getRecordCount()).assertEqual(1); 564 expect(outputData.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_TEXT_WANT); 565 done(); 566 }); 567 console.info('WantTestSync001 end'); 568 }); 569 570 /** 571 * @tc.name PixelMapTestSync001 572 * @tc.desc Test Unified Record of PixelMap 573 * @tc.type FUNC 574 */ 575 it('PixelMapTestSync001', 0, async function (done) { 576 console.info('PixelMapTestSync001 begin'); 577 getPixelMapData(); 578 const systemPasteboard = pasteboard.getSystemPasteboard(); 579 systemPasteboard.setUnifiedDataSync(pixelMapData); 580 const flag = await systemPasteboard.hasPasteData(); 581 expect(flag).assertEqual(true); 582 const outputData = systemPasteboard.getUnifiedDataSync(); 583 let records = outputData.getRecords(); 584 expect(records.length).assertEqual(1); 585 586 systemPasteboard.getData().then((data) => { 587 const outputData = data; 588 expect(outputData.getRecordCount()).assertEqual(1); 589 expect(outputData.getPrimaryMimeType()).assertEqual(pasteboard.MIMETYPE_PIXELMAP); 590 done(); 591 }); 592 console.info('PixelMapTestSync001 end'); 593 }); 594});