8 Star 40 Fork 10

Gitee 极速下载 / Caire

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/esimov/caire
克隆/下载
grayscale_test.go 600 Bytes
一键复制 编辑 原始数据 按行查看 历史
esimov 提交于 2022-10-21 15:38 . test: updated test cases
package caire
import (
"image"
"image/color"
"testing"
)
func TestImage_GrayscaleMode(t *testing.T) {
img := image.NewRGBA(image.Rect(0, 0, imgWidth, imgHeight))
for i := 0; i < img.Bounds().Dx(); i++ {
for j := 0; j < img.Bounds().Dy(); j++ {
img.Set(i, j, color.RGBA{177, 177, 177, 255})
}
}
for i := 0; i < img.Bounds().Dx(); i++ {
for j := 0; j < img.Bounds().Dy(); j++ {
r, g, b, _ := img.At(i, j).RGBA()
r = r >> 8
g = g >> 8
b = b >> 8
if r != g || r != b || g != b {
t.Errorf("R, G, B value expected to be equal. Got %v, %v, %v", r, g, b)
}
}
}
}
Go
1
https://gitee.com/mirrors/Caire.git
git@gitee.com:mirrors/Caire.git
mirrors
Caire
Caire
master

搜索帮助