Skip to content

Commit

Permalink
Merge pull request #217 from mum4k/release-0-10-0
Browse files Browse the repository at this point in the history
Release v0.10.0
  • Loading branch information
mum4k committed Jun 5, 2019
2 parents b60c1c5 + fee34e8 commit 68bf056
Show file tree
Hide file tree
Showing 45 changed files with 3,098 additions and 425 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Expand Up @@ -8,10 +8,13 @@ script:
- go get -t ./...
- go get -u golang.org/x/lint/golint
- go test ./...
- go test -race ./...
- CGO_ENABLED=1 go test -race ./...
- go vet ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- diff -u <(echo -n) <(./internal/scripts/autogen_licences.sh .)
- diff -u <(echo -n) <(golint ./...)
after_success:
- ./internal/scripts/coverage.sh
env:
global:
- CGO_ENABLED=0
27 changes: 26 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0] - 5-Jun-2019

### Added

- Added `time.Duration` based `ValueFormatter` for the `LineChart` Y-axis labels.
- Added round and suffix `ValueFormatter` for the `LineChart` Y-axis labels.
- Added decimal and suffix `ValueFormatter` for the `LineChart` Y-axis labels.
- Added a `container.SplitOption` that allows fixed size container splits.
- Added `grid` functions that allow fixed size rows and columns.

### Changed

- The `LineChart` can format the labels on the Y-axis with a `ValueFormatter`.
- The `SegmentDisplay` can now display dots and colons ('.' and ':').
- The `Donut` widget now guarantees spacing between the donut and its label.
- The continuous build on Travis CI now builds with cgo explicitly disabled to
ensure both Termdash and its dependencies use pure Go.

### Fixed

- Lint issues found on the Go report card.
- An internal library belonging to the `Text` widget was incorrectly passing
`math.MaxUint32` as an int argument.

## [0.9.1] - 15-May-2019

### Fixed
Expand Down Expand Up @@ -271,7 +295,8 @@ identifiers shouldn't be used externally.
- The Gauge widget.
- The Text widget.

[unreleased]: https://github.com/mum4k/termdash/compare/v0.9.1...devel
[unreleased]: https://github.com/mum4k/termdash/compare/v0.10.0...devel
[0.10.0]: https://github.com/mum4k/termdash/compare/v0.9.1...v0.10.0
[0.9.1]: https://github.com/mum4k/termdash/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/mum4k/termdash/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/mum4k/termdash/compare/v0.7.2...v0.8.0
Expand Down
7 changes: 7 additions & 0 deletions container/container.go
Expand Up @@ -171,6 +171,13 @@ func (c *Container) split() (image.Rectangle, image.Rectangle, error) {
if err != nil {
return image.ZR, image.ZR, err
}
if c.opts.splitFixed > DefaultSplitFixed {
if c.opts.split == splitTypeVertical {
return area.VSplitCells(ar, c.opts.splitFixed)
}
return area.HSplitCells(ar, c.opts.splitFixed)
}

if c.opts.split == splitTypeVertical {
return area.VSplit(ar, c.opts.splitPercent)
}
Expand Down
91 changes: 91 additions & 0 deletions container/container_test.go
Expand Up @@ -490,6 +490,45 @@ func TestNew(t *testing.T) {
},
wantContainerErr: true,
},
{
desc: "fails when both SplitFixed and SplitPercent are specified",
termSize: image.Point{10, 10},
container: func(ft *faketerm.Terminal) (*Container, error) {
return New(
ft,
SplitHorizontal(
Top(
Border(linestyle.Light),
),
Bottom(
Border(linestyle.Light),
),
SplitFixed(4),
SplitPercent(20),
),
)
},
wantContainerErr: true,
},
{
desc: "fails on SplitFixed less than -1",
termSize: image.Point{10, 20},
container: func(ft *faketerm.Terminal) (*Container, error) {
return New(
ft,
SplitHorizontal(
Top(
Border(linestyle.Light),
),
Bottom(
Border(linestyle.Light),
),
SplitFixed(-2),
),
)
},
wantContainerErr: true,
},
{
desc: "empty container",
termSize: image.Point{10, 10},
Expand Down Expand Up @@ -616,6 +655,32 @@ func TestNew(t *testing.T) {
return ft
},
},
{
desc: "horizontal unequal split",
termSize: image.Point{10, 20},
container: func(ft *faketerm.Terminal) (*Container, error) {
return New(
ft,
SplitHorizontal(
Top(
Border(linestyle.Light),
),
Bottom(
Border(linestyle.Light),
),
SplitFixed(4),
),
)
},
want: func(size image.Point) *faketerm.Terminal {
ft := faketerm.MustNew(size)
cvs := testcanvas.MustNew(ft.Area())
testdraw.MustBorder(cvs, image.Rect(0, 0, 10, 4))
testdraw.MustBorder(cvs, image.Rect(0, 4, 10, 20))
testcanvas.MustApply(cvs, ft)
return ft
},
},
{
desc: "horizontal split, parent and children have borders",
termSize: image.Point{10, 10},
Expand Down Expand Up @@ -742,6 +807,32 @@ func TestNew(t *testing.T) {
return ft
},
},
{
desc: "vertical fixed splits",
termSize: image.Point{20, 10},
container: func(ft *faketerm.Terminal) (*Container, error) {
return New(
ft,
SplitVertical(
Left(
Border(linestyle.Light),
),
Right(
Border(linestyle.Light),
),
SplitFixed(4),
),
)
},
want: func(size image.Point) *faketerm.Terminal {
ft := faketerm.MustNew(size)
cvs := testcanvas.MustNew(ft.Area())
testdraw.MustBorder(cvs, image.Rect(0, 0, 4, 10))
testdraw.MustBorder(cvs, image.Rect(4, 0, 20, 10))
testcanvas.MustApply(cvs, ft)
return ft
},
},
{
desc: "vertical split, parent and children have borders",
termSize: image.Point{10, 10},
Expand Down

0 comments on commit 68bf056

Please sign in to comment.