feat: increase instance list row height
This commit is contained in:
@@ -3,6 +3,7 @@ package ui
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"image"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
@@ -10,6 +11,8 @@ import (
|
||||
"time"
|
||||
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/unit"
|
||||
"gioui.org/widget/material"
|
||||
)
|
||||
|
||||
@@ -83,6 +86,24 @@ func TestInstanceListColumnWeightsPrioritizeDirectoryAndCompactAction(t *testing
|
||||
}
|
||||
}
|
||||
|
||||
func TestInstanceListRowsUseDoubleStandardHeightAtEveryDPIScale(t *testing.T) {
|
||||
if instanceListRowMinHeight != 2*instanceStandardRowHeight {
|
||||
t.Fatalf("row height = %v, want two times standard height %v", instanceListRowMinHeight, instanceStandardRowHeight)
|
||||
}
|
||||
shell := NewShell(material.NewTheme())
|
||||
for _, scale := range []float32{1, 2} {
|
||||
gtx := layout.Context{
|
||||
Ops: new(op.Ops),
|
||||
Constraints: layout.Constraints{Max: image.Pt(1200, 400)},
|
||||
Metric: unit.Metric{PxPerDp: scale, PxPerSp: scale},
|
||||
}
|
||||
dimensions := shell.instanceListRow(shell.rows[0])(gtx)
|
||||
if want := gtx.Dp(instanceListRowMinHeight); dimensions.Size.Y != want {
|
||||
t.Fatalf("scale %.0f row height = %d, want %d", scale, dimensions.Size.Y, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestShellDeletesOnlyTheRequestedInstance(t *testing.T) {
|
||||
shell := NewShell(material.NewTheme())
|
||||
target := shell.rows[1]
|
||||
|
||||
Reference in New Issue
Block a user