Ai
1 Star 0 Fork 0

nuokwan/chromedp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
emulate_test.go 570 Bytes
一键复制 编辑 原始数据 按行查看 历史
Kenneth Shaw 提交于 2019-06-15 00:30 +08:00 . emulate: further changes
package chromedp
import (
"bytes"
"image/png"
"testing"
"github.com/chromedp/chromedp/device"
)
func TestEmulate(t *testing.T) {
t.Parallel()
ctx, cancel := testAllocate(t, "image.html")
defer cancel()
var buf []byte
if err := Run(ctx,
Emulate(device.IPhone7),
Screenshot(`#half-color`, &buf, ByID),
); err != nil {
t.Fatal(err)
}
img, err := png.Decode(bytes.NewReader(buf))
if err != nil {
t.Fatal(err)
}
size := img.Bounds().Size()
if size.X != 400 || size.Y != 400 {
t.Errorf("expected size 400x400, got: %dx%d", size.X, size.Y)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nuokwan/chromedp.git
git@gitee.com:nuokwan/chromedp.git
nuokwan
chromedp
chromedp
master

搜索帮助