Added a test for the extremities of the Area's actual drawing area to make sure all pixels are shown on all platforms. That seems to be the case right now... Also more TODOs.
This commit is contained in:
parent
a2edde63c2
commit
8259e6d1f8
|
@ -73,7 +73,7 @@ func (a *keyboardArea) Key(e KeyEvent) (handled bool, repaint bool) {
|
|||
return true, true
|
||||
}
|
||||
|
||||
var doKeyboard = flag.Bool("kb", false, "run keyboard test")
|
||||
var doKeyboard = flag.Bool("kb", false, "run keyboard test (overrides -areabounds)")
|
||||
func kbTest() {
|
||||
wid, ht, ah := mkkbArea()
|
||||
a := NewArea(wid, ht, ah)
|
||||
|
|
40
test/main.go
40
test/main.go
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"flag"
|
||||
"image"
|
||||
// "image/color"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
_ "image/png"
|
||||
"bytes"
|
||||
|
@ -140,7 +140,7 @@ func (a *areaHandler) Key(e KeyEvent) (bool, bool) {
|
|||
return false, false
|
||||
}
|
||||
|
||||
var doArea = flag.Bool("area", false, "run area test instead (overrides -kb)")
|
||||
var doArea = flag.Bool("area", false, "run area test instead (overrides -kb and -areabounds)")
|
||||
func areaTest() {
|
||||
/*
|
||||
img := [2]*image.NRGBA{}
|
||||
|
@ -200,6 +200,38 @@ func areaTest() {
|
|||
}
|
||||
}
|
||||
|
||||
var areabounds = flag.Bool("areabounds", false, "run area bounds test instead")
|
||||
func areaboundsTest() {
|
||||
img := image.NewNRGBA(image.Rect(0, 0, 320, 240))
|
||||
a := NewArea(320, 240, &areaHandler{
|
||||
img: img,
|
||||
})
|
||||
u := func(r, g, b uint8) *image.Uniform {
|
||||
return image.NewUniform(color.NRGBA{r, g, b, 255})
|
||||
}
|
||||
// left border red
|
||||
r := img.Rect
|
||||
draw.Draw(img, r, u(255, 0, 0), image.ZP, draw.Over)
|
||||
// bottom border green
|
||||
r.Min.X++
|
||||
draw.Draw(img, r, u(0, 255, 0), image.ZP, draw.Over)
|
||||
// right border blue
|
||||
r.Max.Y--
|
||||
draw.Draw(img, r, u(0, 0, 255), image.ZP, draw.Over)
|
||||
// top border fuscia
|
||||
r.Max.X--
|
||||
draw.Draw(img, r, u(255, 0, 255), image.ZP, draw.Over)
|
||||
// middle purple
|
||||
r.Min.Y++
|
||||
draw.Draw(img, r, u(128, 0, 128), image.ZP, draw.Over)
|
||||
w := NewWindow("Area Bounds Test", 320, 240)
|
||||
err := w.Open(a)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
<-w.Closing
|
||||
}
|
||||
|
||||
func myMain() {
|
||||
if *doArea {
|
||||
areaTest()
|
||||
|
@ -209,6 +241,10 @@ func myMain() {
|
|||
kbTest()
|
||||
return
|
||||
}
|
||||
if *areabounds {
|
||||
areaboundsTest()
|
||||
return
|
||||
}
|
||||
w := NewWindow("Main Window", 320, 240)
|
||||
b := NewButton("Click Me")
|
||||
b2 := NewButton("Or Me")
|
||||
|
|
3
todo.md
3
todo.md
|
@ -29,6 +29,7 @@ important things:
|
|||
- does not show initially on OS X; it shows up once you resize, and even shows up after you resize back to the original size
|
||||
|
||||
super ultra important things:
|
||||
- window sizes are inconsistent and wrong: we need to see on which platforms the titlebars/borders/etc. count...
|
||||
- formalize what happens if Modifiers by themselves are held
|
||||
- OS X: find out if multiple DIFFERENT modifiers released at once produces multiple events
|
||||
- in general, figure out what to do on multiple events, period
|
||||
|
@ -62,7 +63,7 @@ super ultra important things:
|
|||
- TODO find out if this is a problem on the GTK+/Wayland side (no initial window-configure event?)
|
||||
- redrawing Areas on Windows seems to be flaky: make the window small, scroll, then make it large again and watch the vertical corruption (alternatively "especially after changing the Area size to something larger than the window size and then resizing the window(???)")
|
||||
- redrawing controls after a window resize on Windows seems to be flaky
|
||||
- make sure the first and last rows and columns of an Area are being drawn on all platforms
|
||||
- for Area again, the area bounds test's borders don't redraw correctly after certain series of resize operations
|
||||
- clicking on Areas in GTK+ don't bring keyboard focus to them?
|
||||
- make sure keyboard events on numpad off on all platforms don't switch between controls
|
||||
- despite us explicitly clearing the clip area on Windows, Area still doesn't seem to draw alpha bits correctly... it appears as if we are drawing over the existing image each time
|
||||
|
|
Loading…
Reference in New Issue