mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
app/clipboard: delete
The implementation was too optimistic: some platforms require a window context for accessing the clipboard. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
|
||||||
|
|
||||||
// +build android
|
|
||||||
|
|
||||||
// Package clipboard accesses the system clipboard.
|
|
||||||
package clipboard
|
|
||||||
|
|
||||||
import (
|
|
||||||
"gioui.org/app/internal/window"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Read the content of the clipboard as a string.
|
|
||||||
func Read() (string, error) {
|
|
||||||
return window.ReadClipboard()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write a string to the clipboard.
|
|
||||||
func Write(s string) error {
|
|
||||||
return window.WriteClipboard(s)
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Unlicense OR MIT
|
|
||||||
|
|
||||||
// +build android
|
|
||||||
|
|
||||||
package clipboard
|
|
||||||
|
|
||||||
import "testing"
|
|
||||||
|
|
||||||
func TestClipboard(t *testing.T) {
|
|
||||||
const want = "Hello, 世界"
|
|
||||||
if err := Write(want); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
got, err := Read()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if got != want {
|
|
||||||
t.Errorf("read %q from the clipboard, wanted %q", got, want)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user