mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Update clipboard_test
This commit is contained in:
parent
cfd8eb3597
commit
269d259e1f
@ -7,18 +7,18 @@ package clipboard_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/go-vgo/robotgo/clipboard"
|
"github.com/go-vgo/robotgo/clipboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// func TestCopyAndPaste(t *testing.T) {
|
// func TestCopyAndPaste(t *testing.T) {
|
||||||
// expected := "日本語"
|
// expected := "日本語"
|
||||||
|
|
||||||
// err := WriteAll(expected)
|
// err := clipboard.WriteAll(expected)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// actual, err := ReadAll()
|
// actual, err := clipboard.ReadAll()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
@ -32,12 +32,12 @@ import (
|
|||||||
// expected1 := "French: éèêëàùœç"
|
// expected1 := "French: éèêëàùœç"
|
||||||
// expected2 := "Weird UTF-8: 💩☃"
|
// expected2 := "Weird UTF-8: 💩☃"
|
||||||
|
|
||||||
// err := WriteAll(expected1)
|
// err := clipboard.WriteAll(expected1)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// actual1, err := ReadAll()
|
// actual1, err := clipboard.ReadAll()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
@ -45,12 +45,12 @@ import (
|
|||||||
// t.Errorf("want %s, got %s", expected1, actual1)
|
// t.Errorf("want %s, got %s", expected1, actual1)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// err = WriteAll(expected2)
|
// err = clipboard.WriteAll(expected2)
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// actual2, err := ReadAll()
|
// actual2, err := clipboard.ReadAll()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// t.Fatal(err)
|
// t.Fatal(err)
|
||||||
// }
|
// }
|
||||||
@ -59,15 +59,15 @@ import (
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func BenchmarkReadAll(b *testing.B) {
|
func Benchmarkclipboard.ReadAll(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
ReadAll()
|
clipboard.ReadAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkWriteAll(b *testing.B) {
|
func Benchmarkclipboard.WriteAll(b *testing.B) {
|
||||||
text := "いろはにほへと"
|
text := "いろはにほへと"
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
WriteAll(text)
|
clipboard.WriteAll(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,10 @@ func Example() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(text)
|
if text != "" {
|
||||||
// Output:
|
fmt.Println(text)
|
||||||
// 日本語
|
// Output:
|
||||||
|
// 日本語
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user