mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-30 22:13:54 +00:00
Export ToUC function and update test code
This commit is contained in:
parent
58057ea219
commit
45251144e5
@ -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 {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user