public sealed class HeadlessClipboardNo clipboard.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
An in-process buffer pretending to be a clipboard was the obvious alternative and is the wrong one: it would make copy-and-paste appear to work in a headless test and then not work in the product, because a clipboard's entire purpose is to be shared with other applications and there are none here. Refusing is the honest report of what a server can do, and it is what Clipboard already says.
Code that wants a controllable clipboard for a test wants a test double, which is a different object with a different name.
Fields and properties (2)
public bool HasTextWhether the clipboard currently holds text.
public bool HasImageWhether the clipboard currently holds an image.
Methods (7)
public bool TryGetText(out string? text)Reads the clipboard's text.
public bool SetText(string text)Puts text on the clipboard.
public bool TryGetImage(out ClipboardImage image)Reads the clipboard's image.
public bool SetImage(in ClipboardImage image)Puts an image on the clipboard.
public bool TryGetData(string format, out ReadOnlyMemory<byte> data)Reads a custom format's bytes.
public bool SetData(string format, ReadOnlySpan<byte> data)Puts a custom format's bytes on the clipboard.
public void Clear()Empties the clipboard, if the platform allows it.
Used by (1)
- HeadlessPlatformVixen.Platform.Headless