From df2e971757741f09ea7836799d75d3f6c184c33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=B3=93=E9=93=AE?= Date: Tue, 6 Aug 2024 14:38:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BAresult=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hrp/pkg/uixt/android_test.go | 26 +++++++++++++------------- hrp/pkg/uixt/ext.go | 2 +- hrp/pkg/utf7/utf7_test.go | 11 +++++++++++ 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 hrp/pkg/utf7/utf7_test.go diff --git a/hrp/pkg/uixt/android_test.go b/hrp/pkg/uixt/android_test.go index 0aeb0d51..0dafd3d4 100644 --- a/hrp/pkg/uixt/android_test.go +++ b/hrp/pkg/uixt/android_test.go @@ -22,8 +22,8 @@ var ( func setupAndroid(t *testing.T) { device, err := NewAndroidDevice() checkErr(t, err) - device.UIA2 = false - device.LogOn = true + device.UIA2 = true + device.LogOn = false driverExt, err = device.NewDriver() checkErr(t, err) } @@ -197,19 +197,19 @@ func TestDriver_DeviceInfo(t *testing.T) { func TestDriver_Tap(t *testing.T) { setupAndroid(t) driverExt.Driver.StartCaptureLog("") - err := driverExt.Driver.Tap(150, 340, WithIdentifier("test")) + err := driverExt.TapXY(0.5, 0.5, WithIdentifier("test"), WithPressDuration(4)) if err != nil { t.Fatal(err) } - time.Sleep(time.Second) - - err = driverExt.Driver.TapFloat(60.5, 125.5, WithIdentifier("test")) - if err != nil { - t.Fatal(err) - } - time.Sleep(time.Second) - result, _ := driverExt.Driver.StopCaptureLog() - t.Log(result) + //time.Sleep(time.Second) + // + //err = driverExt.Driver.TapFloat(60.5, 125.5, WithIdentifier("test")) + //if err != nil { + // t.Fatal(err) + //} + //time.Sleep(time.Second) + //result, _ := driverExt.Driver.StopCaptureLog() + //t.Log(result) } func TestDriver_Swipe(t *testing.T) { @@ -250,7 +250,7 @@ func TestDriver_Drag(t *testing.T) { func TestDriver_SendKeys(t *testing.T) { setupAndroid(t) - err := driverExt.Driver.SendKeys("Android\"输入速度测试", WithIdentifier("test")) + err := driverExt.Driver.SendKeys("辽宁省沈阳市新民市民族街36-4", WithIdentifier("test")) if err != nil { t.Fatal(err) } diff --git a/hrp/pkg/uixt/ext.go b/hrp/pkg/uixt/ext.go index 0a924ca2..dc1a51de 100644 --- a/hrp/pkg/uixt/ext.go +++ b/hrp/pkg/uixt/ext.go @@ -156,7 +156,7 @@ type DriverExt struct { } func newDriverExt(device Device, driver WebDriver, options ...DriverOption) (dExt *DriverExt, err error) { - driverOptions := &DriverOptions{} + driverOptions := NewDriverOptions() for _, option := range options { option(driverOptions) } diff --git a/hrp/pkg/utf7/utf7_test.go b/hrp/pkg/utf7/utf7_test.go new file mode 100644 index 00000000..c729f04e --- /dev/null +++ b/hrp/pkg/utf7/utf7_test.go @@ -0,0 +1,11 @@ +package utf7 + +import "testing" + +func Test_Decode(t *testing.T) { + str, err := Encoding.NewDecoder().String("&j71bgXcBbIiWM14CZbBsEV4CbBFlz4hX-36-4") + if err != nil { + t.Fatal(err) + } + t.Log(str) +}