■ ■ ■ ■ ■ ■
widgets/gauge/gauge_test.go
| skipped 913 lines |
914 | 914 | | return ft |
915 | 915 | | }, |
916 | 916 | | }, |
| 917 | + | { |
| 918 | + | desc: "progress below threshold", |
| 919 | + | opts: []Option{ |
| 920 | + | Char('o'), |
| 921 | + | Threshold(5, linestyle.Light, cell.BgColor(cell.ColorRed)), |
| 922 | + | HideTextProgress(), |
| 923 | + | }, |
| 924 | + | absolute: &absoluteCall{done: 4, total: 10}, |
| 925 | + | canvas: image.Rect(0, 0, 10, 3), |
| 926 | + | want: func(size image.Point) *faketerm.Terminal { |
| 927 | + | ft := faketerm.MustNew(size) |
| 928 | + | c := testcanvas.MustNew(ft.Area()) |
| 929 | + | |
| 930 | + | testdraw.MustRectangle(c, image.Rect(0, 0, 4, 3), |
| 931 | + | draw.RectChar('o'), |
| 932 | + | draw.RectCellOpts(cell.BgColor(cell.ColorGreen)), |
| 933 | + | ) |
| 934 | + | testdraw.MustHVLines(c, []draw.HVLine{{ |
| 935 | + | Start: image.Point{X: 5, Y: 0}, |
| 936 | + | End: image.Point{X: 5, Y: 2}, |
| 937 | + | }}, draw.HVLineStyle(linestyle.Light), |
| 938 | + | draw.HVLineCellOpts(cell.BgColor(cell.ColorRed))) |
| 939 | + | testcanvas.MustApply(c, ft) |
| 940 | + | return ft |
| 941 | + | }, |
| 942 | + | }, |
| 943 | + | { |
| 944 | + | desc: "progress exactly at threshold", |
| 945 | + | opts: []Option{ |
| 946 | + | Char('o'), |
| 947 | + | Threshold(5, linestyle.Light, cell.BgColor(cell.ColorRed)), |
| 948 | + | HideTextProgress(), |
| 949 | + | }, |
| 950 | + | absolute: &absoluteCall{done: 5, total: 10}, |
| 951 | + | canvas: image.Rect(0, 0, 10, 3), |
| 952 | + | want: func(size image.Point) *faketerm.Terminal { |
| 953 | + | ft := faketerm.MustNew(size) |
| 954 | + | c := testcanvas.MustNew(ft.Area()) |
| 955 | + | |
| 956 | + | testdraw.MustRectangle(c, image.Rect(0, 0, 5, 3), |
| 957 | + | draw.RectChar('o'), |
| 958 | + | draw.RectCellOpts(cell.BgColor(cell.ColorGreen)), |
| 959 | + | ) |
| 960 | + | testdraw.MustHVLines(c, []draw.HVLine{{ |
| 961 | + | Start: image.Point{X: 5, Y: 0}, |
| 962 | + | End: image.Point{X: 5, Y: 2}, |
| 963 | + | }}, draw.HVLineStyle(linestyle.Light), |
| 964 | + | draw.HVLineCellOpts(cell.BgColor(cell.ColorRed))) |
| 965 | + | testcanvas.MustApply(c, ft) |
| 966 | + | return ft |
| 967 | + | }, |
| 968 | + | }, |
| 969 | + | { |
| 970 | + | desc: "progress after threshold", |
| 971 | + | opts: []Option{ |
| 972 | + | Char('o'), |
| 973 | + | Threshold(5, linestyle.Light, cell.BgColor(cell.ColorRed)), |
| 974 | + | HideTextProgress(), |
| 975 | + | }, |
| 976 | + | absolute: &absoluteCall{done: 6, total: 10}, |
| 977 | + | canvas: image.Rect(0, 0, 10, 3), |
| 978 | + | want: func(size image.Point) *faketerm.Terminal { |
| 979 | + | ft := faketerm.MustNew(size) |
| 980 | + | c := testcanvas.MustNew(ft.Area()) |
| 981 | + | |
| 982 | + | testdraw.MustRectangle(c, image.Rect(0, 0, 6, 3), |
| 983 | + | draw.RectChar('o'), |
| 984 | + | draw.RectCellOpts(cell.BgColor(cell.ColorGreen)), |
| 985 | + | ) |
| 986 | + | testdraw.MustHVLines(c, []draw.HVLine{{ |
| 987 | + | Start: image.Point{X: 5, Y: 0}, |
| 988 | + | End: image.Point{X: 5, Y: 2}, |
| 989 | + | }}, draw.HVLineStyle(linestyle.Light), |
| 990 | + | draw.HVLineCellOpts(cell.BgColor(cell.ColorRed))) |
| 991 | + | testcanvas.MustApply(c, ft) |
| 992 | + | return ft |
| 993 | + | }, |
| 994 | + | }, |
917 | 995 | | } |
918 | 996 | | |
919 | 997 | | for _, tc := range tests { |
| skipped 157 lines |