mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee305702e8 | ||
|
|
63abcc92ba |
28
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Information**
|
||||
- OS: [eg Windows/Linux/MacOS]
|
||||
- Version: [e.g. 0.33.0]
|
||||
- Terminal: [e.g Windows Terminal]
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -59,7 +59,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task Foo()
|
||||
public Task Should_Reduce_Width_If_Needed()
|
||||
{
|
||||
// Given
|
||||
var console = new PlainConsole(width: 20);
|
||||
@@ -87,5 +87,29 @@ namespace Spectre.Console.Tests.Unit
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Setting_Max_Value_Should_Set_The_MaxValue_And_Cap_Value()
|
||||
{
|
||||
// Given
|
||||
var task = default(ProgressTask);
|
||||
var console = new PlainConsole();
|
||||
var progress = new Progress(console)
|
||||
.Columns(new[] { new ProgressBarColumn() })
|
||||
.AutoRefresh(false)
|
||||
.AutoClear(false);
|
||||
|
||||
// When
|
||||
progress.Start(ctx =>
|
||||
{
|
||||
task = ctx.AddTask("foo");
|
||||
task.Increment(100);
|
||||
task.MaxValue = 20;
|
||||
});
|
||||
|
||||
// Then
|
||||
task.MaxValue.ShouldBe(20);
|
||||
task.Value.ShouldBe(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Spectre.Console
|
||||
|
||||
if (maxValue != null)
|
||||
{
|
||||
_maxValue += maxValue.Value;
|
||||
_maxValue = maxValue.Value;
|
||||
}
|
||||
|
||||
if (increment != null)
|
||||
@@ -175,6 +175,12 @@ namespace Spectre.Console
|
||||
Value += increment.Value;
|
||||
}
|
||||
|
||||
// Need to cap the max value?
|
||||
if (Value > _maxValue)
|
||||
{
|
||||
Value = _maxValue;
|
||||
}
|
||||
|
||||
var timestamp = DateTime.Now;
|
||||
var threshold = timestamp - TimeSpan.FromSeconds(30);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user