Skip to content

Commit 776c1f9

Browse files
committed
add tests
1 parent e8301be commit 776c1f9

File tree

13 files changed

+537
-24
lines changed

13 files changed

+537
-24
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- "/go/pkg/mod"
2323
- run:
2424
name: run static analysis
25-
command: make ci-static-analyses
25+
command: make ci-static-analysis
2626

2727
run-tests:
2828
parameters:

.github/workflows/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
run: go get ./...
6565

6666
- name: Linting, formatting, and other static code analyses
67-
run: make ci-static-analyses
67+
run: make ci-static-analysis
6868

6969
- name: Build snapshot artifacts
7070
run: make ci-build-snapshot-packages

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ all: clean build
1212
ci-unit-test:
1313
go test -cover -v -race ./...
1414

15-
ci-static-analyses:
15+
ci-static-analysis:
1616
grep -R 'const allowTestDataCapture = false' runtime/ui/viewmodel
1717
go vet ./...
1818
@! gofmt -s -l . 2>&1 | grep -vE '^\.git/' | grep -vE '^\.cache/'

runtime/ui/app.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ func newApp(gui *gocui.Gui, analysis *image.AnalysisResult, cache filetree.Compa
4444
lm.Add(compound.NewLayerDetailsCompoundLayout(controller.views.Layer, controller.views.Details), layout.LocationColumn)
4545
lm.Add(controller.views.Tree, layout.LocationColumn)
4646

47+
// todo: access this more programmatically
48+
if debug {
49+
lm.Add(controller.views.Debug, layout.LocationColumn)
50+
}
4751
gui.Cursor = false
4852
//g.Mouse = true
4953
gui.SetManagerFunc(lm.Layout)

runtime/ui/layout/manager.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (lm *Manager) planAndLayoutColumns(g *gocui.Gui, area Area) (Area, error) {
113113
}
114114
}
115115

116-
defaultWidth := int(availableWidth / variableColumns)
116+
defaultWidth := availableWidth / variableColumns
117117

118118
// second pass: layout columns left to right (based off predetermined widths)
119119
for idx, element := range elements {
@@ -177,18 +177,22 @@ func (lm *Manager) notifyLayoutChange() error {
177177
return nil
178178
}
179179

180+
func (lm *Manager) Layout(g *gocui.Gui) error {
181+
curMaxX, curMaxY := g.Size()
182+
return lm.layout(g, curMaxX, curMaxY)
183+
}
184+
180185
// layout defines the definition of the window pane size and placement relations to one another. This
181186
// is invoked at application start and whenever the screen dimensions change.
182187
// A few things to note:
183188
// 1. gocui has borders around all views (even if Frame=false). This means there are a lot of +1/-1 magic numbers
184189
// needed (but there are comments!).
185190
// 2. since there are borders, in order for it to appear as if there aren't any spaces for borders, the views must
186191
// overlap. To prevent screen artifacts, all elements must be layedout from the top of the screen to the bottom.
187-
func (lm *Manager) Layout(g *gocui.Gui) error {
192+
func (lm *Manager) layout(g *gocui.Gui, curMaxX, curMaxY int) error {
188193
var headerAreaChanged, footerAreaChanged, columnAreaChanged bool
189194

190-
// grab the latest screen size and compare with the last layout
191-
curMaxX, curMaxY := g.Size()
195+
// compare current screen size with the last known size at time of layout
192196
area := Area{
193197
minX: -1,
194198
minY: -1,

0 commit comments

Comments
 (0)