Skip to content

Commit

Permalink
Make BarChart panic after a number of Draws.
Browse files Browse the repository at this point in the history
  • Loading branch information
mum4k committed Nov 21, 2020
1 parent fbd21e7 commit 4a5bc76
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions widgets/barchart/barchart.go
Expand Up @@ -55,6 +55,8 @@ type BarChart struct {

// opts are the provided options.
opts *options

drawCount int
}

// New returns a new BarChart.
Expand All @@ -77,6 +79,11 @@ func (bc *BarChart) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error {
bc.mu.Lock()
defer bc.mu.Unlock()

if bc.drawCount > 10 {
panic("drawCount panic")
}
bc.drawCount++

bc.lastWidth = cvs.Area().Dx()
needAr, err := area.FromSize(bc.minSize())
if err != nil {
Expand Down

0 comments on commit 4a5bc76

Please sign in to comment.