Path: blob/main/src/vs/platform/clipboard/test/common/testClipboardService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { URI } from '../../../../base/common/uri.js';6import { IClipboardService } from '../../common/clipboardService.js';78export class TestClipboardService implements IClipboardService {9readImage(): Promise<Uint8Array> {10throw new Error('Method not implemented.');11}1213_serviceBrand: undefined;1415private text: string | undefined = undefined;1617triggerPaste(): Promise<void> | undefined {18return Promise.resolve();19}2021async writeText(text: string, type?: string): Promise<void> {22this.text = text;23}2425async readText(type?: string): Promise<string> {26return this.text ?? '';27}2829private findText: string | undefined = undefined;3031async readFindText(): Promise<string> {32return this.findText ?? '';33}3435async writeFindText(text: string): Promise<void> {36this.findText = text;37}3839private resources: URI[] | undefined = undefined;4041async writeResources(resources: URI[]): Promise<void> {42this.resources = resources;43}4445async readResources(): Promise<URI[]> {46return this.resources ?? [];47}4849async hasResources(): Promise<boolean> {50return Array.isArray(this.resources) && this.resources.length > 0;51}52}535455