mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-06 00:33:55 +00:00
Merge pull request #255 from go-vgo/dev
Use CGDisplayBounds and update info test code
This commit is contained in:
commit
9c21c09ef9
@ -11,6 +11,7 @@ jobs:
|
|||||||
# specify any bash command here prefixed with `run: `
|
# specify any bash command here prefixed with `run: `
|
||||||
- run: apt-get update
|
- run: apt-get update
|
||||||
- run: apt-get -y install xvfb
|
- run: apt-get -y install xvfb
|
||||||
|
#
|
||||||
# override:
|
# override:
|
||||||
# './...' is a relative pattern which means all subdirectories
|
# './...' is a relative pattern which means all subdirectories
|
||||||
# - run: go get -u github.com/go-vgo/robotgo
|
# - run: go get -u github.com/go-vgo/robotgo
|
||||||
|
3
.github/workflows/go.yml
vendored
3
.github/workflows/go.yml
vendored
@ -29,5 +29,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: go build -v .
|
run: go build -v .
|
||||||
# - name: Test
|
- name: Test
|
||||||
|
run: go test -v robot_info_test.go
|
||||||
# run: go test -v .
|
# run: go test -v .
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
package robotgo
|
package robotgo_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -16,22 +16,23 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/go-vgo/robotgo"
|
||||||
"github.com/vcaesar/tt"
|
"github.com/vcaesar/tt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetVer(t *testing.T) {
|
func TestGetVer(t *testing.T) {
|
||||||
fmt.Println("go version: ", runtime.Version())
|
fmt.Println("go version: ", runtime.Version())
|
||||||
ver := GetVersion()
|
ver := robotgo.GetVersion()
|
||||||
|
|
||||||
tt.Expect(t, Version, ver)
|
tt.Expect(t, robotgo.Version, ver)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetScreenSize(t *testing.T) {
|
func TestGetScreenSize(t *testing.T) {
|
||||||
x, y := GetScreenSize()
|
x, y := robotgo.GetScreenSize()
|
||||||
log.Println("GetScreenSize: ", x, y)
|
log.Println("GetScreenSize: ", x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetSysScale(t *testing.T) {
|
func TestGetSysScale(t *testing.T) {
|
||||||
s := SysScale()
|
s := robotgo.SysScale()
|
||||||
log.Println("SysScale: ", s)
|
log.Println("SysScale: ", s)
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@
|
|||||||
MMSizeInt32 getMainDisplaySize(void){
|
MMSizeInt32 getMainDisplaySize(void){
|
||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
CGDirectDisplayID displayID = CGMainDisplayID();
|
CGDirectDisplayID displayID = CGMainDisplayID();
|
||||||
return MMSizeInt32Make((int32_t)CGDisplayPixelsWide(displayID),
|
CGRect displayRect = CGDisplayBounds(displayID);
|
||||||
(int32_t)CGDisplayPixelsHigh(displayID));
|
|
||||||
|
CGSize size = displayRect.size;
|
||||||
|
return MMSizeInt32Make((int32_t)size.width, (int32_t)size.height);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
const int screen = DefaultScreen(display);
|
const int screen = DefaultScreen(display);
|
||||||
|
Loading…
Reference in New Issue
Block a user