-
-
Notifications
You must be signed in to change notification settings - Fork 623
Add setting to disable thousands separator in Calculator plugin #4206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
34257ca
649b142
fb4da69
013622a
7e7f853
befcc9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,8 @@ | |
| using System.Reflection; | ||
| using Flow.Launcher.Plugin.Calculator; | ||
| using Mages.Core; | ||
| using NUnit.Framework; | ||
|
Check warning on line 6 in Flow.Launcher.Test/Plugins/CalculatorTest.cs
|
||
| using NUnit.Framework.Legacy; | ||
|
Check warning on line 7 in Flow.Launcher.Test/Plugins/CalculatorTest.cs
|
||
|
|
||
| namespace Flow.Launcher.Test.Plugins | ||
| { | ||
|
|
@@ -16,7 +16,8 @@ | |
| { | ||
| DecimalSeparator = DecimalSeparator.UseSystemLocale, | ||
| MaxDecimalPlaces = 10, | ||
| ShowErrorMessage = false // Make sure we return the empty results when error occurs | ||
| ShowErrorMessage = false, // Make sure we return the empty results when error occurs | ||
| UseThousandsSeparator = true // Default value | ||
| }; | ||
| private readonly Engine _engine = new(new Configuration | ||
| { | ||
|
|
@@ -41,6 +42,38 @@ | |
| engineField.SetValue(null, _engine); | ||
| } | ||
|
|
||
| [Test] | ||
| public void ThousandsSeparatorTest_Enabled() | ||
| { | ||
| _settings.UseThousandsSeparator = true; | ||
| _settings.DecimalSeparator = DecimalSeparator.Dot; | ||
|
|
||
| var result = GetCalculationResult("1000+234"); | ||
| // When thousands separator is enabled, the result should contain a separator (comma in this case) | ||
| ClassicAssert.IsTrue(result.Contains(",") || result == "1234", | ||
| "Expected result to contain thousands separator or be without one if system doesn't use it"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the result is fixed "1,234" why do we meed the OR condition here?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is AI-generated. It has been modified. |
||
| } | ||
|
|
||
| [Test] | ||
| public void ThousandsSeparatorTest_Disabled() | ||
| { | ||
| _settings.UseThousandsSeparator = false; | ||
| _settings.DecimalSeparator = DecimalSeparator.Dot; | ||
|
|
||
| var result = GetCalculationResult("1000+234"); | ||
| ClassicAssert.AreEqual("1234", result); | ||
| } | ||
|
|
||
| [Test] | ||
| public void ThousandsSeparatorTest_LargeNumber() | ||
| { | ||
| _settings.UseThousandsSeparator = false; | ||
| _settings.DecimalSeparator = DecimalSeparator.Dot; | ||
|
|
||
| var result = GetCalculationResult("1000000+234567"); | ||
| ClassicAssert.AreEqual("1234567", result); | ||
| } | ||
|
|
||
| // Basic operations | ||
| [TestCase(@"1+1", "2")] | ||
| [TestCase(@"2-1", "1")] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.