From 45251144e506c053a312127b031943ee99649365 Mon Sep 17 00:00:00 2001 From: vcaesar Date: Thu, 19 Aug 2021 14:03:11 -0400 Subject: [PATCH] Export ToUC function and update test code --- robotgo.go | 7 ++++--- robotgo_test.go | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/robotgo.go b/robotgo.go index 95e35dd..f6bf0dd 100644 --- a/robotgo.go +++ b/robotgo.go @@ -75,7 +75,7 @@ import ( const ( // Version get the robotgo version - Version = "v0.93.1.1189, MT. Rainier!" + Version = "v0.99.1.1189, MT. Rainier!" ) // GetVersion get the robotgo version @@ -730,7 +730,8 @@ func UnicodeType(str uint32) { C.unicodeType(cstr) } -func toUC(text string) []string { +// ToUC trans string to unicode []string +func ToUC(text string) []string { var uc []string for _, r := range text { @@ -768,7 +769,7 @@ func TypeStr(str string, args ...float64) { } if runtime.GOOS == "linux" { - strUc := toUC(str) + strUc := ToUC(str) for i := 0; i < len(strUc); i++ { ru := []rune(strUc[i]) if len(ru) <= 1 { diff --git a/robotgo_test.go b/robotgo_test.go index 34f0500..cce772a 100644 --- a/robotgo_test.go +++ b/robotgo_test.go @@ -126,8 +126,9 @@ func TestTypeStr(t *testing.T) { e := PasteStr("s") tt.Empty(t, e) - uc := toUC("s") - tt.Equal(t, "[s]", uc) + s1 := "abc\\\\cd/s@世界" + uc := ToUC(s1) + tt.Equal(t, "[a b c \\ \\ c d / s @ U4e16 U754c]", uc) } func TestKeyCode(t *testing.T) {