Skip to content

Commit

Permalink
Fixing GLFW test too
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 16, 2024
1 parent bd7c521 commit 9b720cb
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
6 changes: 0 additions & 6 deletions internal/driver/glfw/canvas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,12 @@ func TestGlCanvas_PixelCoordinateAtPosition(t *testing.T) {
c := w.Canvas().(*glCanvas)

pos := fyne.NewPos(4, 4)
c.Lock()
c.scale = 2.5
c.Unlock()
x, y := c.PixelCoordinateForPosition(pos)
assert.Equal(t, int(10*c.texScale), x)
assert.Equal(t, int(10*c.texScale), y)

c.Lock()
c.texScale = 2.0
c.Unlock()
x, y = c.PixelCoordinateForPosition(pos)
assert.Equal(t, 20, x)
assert.Equal(t, 20, y)
Expand Down Expand Up @@ -503,9 +499,7 @@ func TestGlCanvas_Scale(t *testing.T) {
w := createWindow("Test").(*window)
c := w.Canvas().(*glCanvas)

c.Lock()
c.scale = 2.5
c.Unlock()
assert.Equal(t, 5, int(2*c.Scale()))
}

Expand Down
2 changes: 0 additions & 2 deletions internal/driver/glfw/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ func Test_gLDriver_AbsolutePositionForObject(t *testing.T) {
// We work around w.SetMainMenu because on MacOS the main menu is a native menu.
c := w.canvas
movl := buildMenuOverlay(mm, w)
c.Lock()
c.setMenuOverlay(movl)
c.Unlock()
w.SetContent(content)
w.Resize(fyne.NewSize(300, 200))
ensureCanvasSize(t, w, fyne.NewSize(300, 200))
Expand Down
8 changes: 0 additions & 8 deletions internal/driver/glfw/window_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ func TestWindow_ToggleMainMenuByKeyboard(t *testing.T) {
c := w.canvas
m := fyne.NewMainMenu(fyne.NewMenu("File"), fyne.NewMenu("Edit"), fyne.NewMenu("Help"))
menuBar := buildMenuOverlay(m, w).(*MenuBar)
c.Lock()
c.setMenuOverlay(menuBar)
c.Unlock()
w.SetContent(canvas.NewRectangle(color.Black))

altPressingMod := glfw.ModAlt
Expand Down Expand Up @@ -324,25 +322,19 @@ func TestWindow_HandleOutsideHoverableObject(t *testing.T) {
w.mouseMoved(w.viewport, 15, 48)
w.WaitForEvents()
repaintWindow(w)
w.mouseLock.RLock()
assert.NotNil(t, w.mouseOver)
w.mouseLock.RUnlock()
test.AssertRendersToMarkup(t, "windows_hover_object.xml", w.Canvas())

w.mouseMoved(w.viewport, 42, 48)
w.WaitForEvents()
repaintWindow(w)
w.mouseLock.RLock()
assert.NotNil(t, w.mouseOver)
w.mouseLock.RUnlock()
test.AssertRendersToMarkup(t, "windows_hover_object.xml", w.Canvas())

w.mouseMoved(w.viewport, 42, 100)
w.WaitForEvents()
repaintWindow(w)
w.mouseLock.RLock()
assert.Nil(t, w.mouseOver)
w.mouseLock.RUnlock()
test.AssertRendersToMarkup(t, "windows_no_hover_outside_object.xml", w.Canvas())
}

Expand Down

0 comments on commit 9b720cb

Please sign in to comment.