mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Merge pull request #353 from go-vgo/bitmap-pr
Export ToUC function and update test code
This commit is contained in:
commit
44939e5933
@ -75,7 +75,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Version get the robotgo version
|
// Version get the robotgo version
|
||||||
Version = "v0.93.1.1189, MT. Rainier!"
|
Version = "v0.99.1.1189, MT. Rainier!"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetVersion get the robotgo version
|
// GetVersion get the robotgo version
|
||||||
@ -730,7 +730,8 @@ func UnicodeType(str uint32) {
|
|||||||
C.unicodeType(cstr)
|
C.unicodeType(cstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func toUC(text string) []string {
|
// ToUC trans string to unicode []string
|
||||||
|
func ToUC(text string) []string {
|
||||||
var uc []string
|
var uc []string
|
||||||
|
|
||||||
for _, r := range text {
|
for _, r := range text {
|
||||||
@ -768,7 +769,7 @@ func TypeStr(str string, args ...float64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
strUc := toUC(str)
|
strUc := ToUC(str)
|
||||||
for i := 0; i < len(strUc); i++ {
|
for i := 0; i < len(strUc); i++ {
|
||||||
ru := []rune(strUc[i])
|
ru := []rune(strUc[i])
|
||||||
if len(ru) <= 1 {
|
if len(ru) <= 1 {
|
||||||
|
@ -126,8 +126,9 @@ func TestTypeStr(t *testing.T) {
|
|||||||
e := PasteStr("s")
|
e := PasteStr("s")
|
||||||
tt.Empty(t, e)
|
tt.Empty(t, e)
|
||||||
|
|
||||||
uc := toUC("s")
|
s1 := "abc\\\\cd/s@世界"
|
||||||
tt.Equal(t, "[s]", uc)
|
uc := ToUC(s1)
|
||||||
|
tt.Equal(t, "[a b c \\ \\ c d / s @ U4e16 U754c]", uc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestKeyCode(t *testing.T) {
|
func TestKeyCode(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user