mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
removed restrictions for image-resizer file format (#3377)
This commit is contained in:
parent
7c7ccc3a07
commit
30cb7e62fd
@ -178,10 +178,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
set
|
||||
{
|
||||
var regex = @"[%]{1}[1-6]{1} [(]{1}[%]{1}[1-6]{1}[)]{1}";
|
||||
Match match = Regex.Match(value.Trim(), regex);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(value) && match.Success)
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
_fileName = value;
|
||||
Settings.Properties.ImageresizerFileName.Value = value;
|
||||
|
@ -124,38 +124,6 @@ namespace ViewModelTests
|
||||
Assert.AreEqual(expectedValue, viewModel.FileName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FileName_ShouldNOTUpdateValue_WhenNameIsInValid ()
|
||||
{
|
||||
// arrange
|
||||
ImageResizerViewModel viewModel = new ImageResizerViewModel();
|
||||
string[] invalidNames =
|
||||
{
|
||||
string.Empty,
|
||||
" ", // no name.
|
||||
"%1", // single name value.
|
||||
"%7 (%5)", // name max index exceeded.
|
||||
"%8 (%8)", // name max index exceeded.
|
||||
"%5 (%3 )", // name contains extra spaces.
|
||||
"%5 (%3)", // name contains extra spaces.
|
||||
"%5 ( %3)", // name contains extra spaces.
|
||||
"% 5 ( %3)", // name contains extra spaces.
|
||||
"%5 (% 3)", // name contains extra spaces.
|
||||
"%5 ( %3 )", // name contains extra spaces.
|
||||
};
|
||||
|
||||
// act and Assert
|
||||
foreach (string invalidName in invalidNames)
|
||||
{
|
||||
viewModel = new ImageResizerViewModel();
|
||||
viewModel.FileName = invalidName;
|
||||
Assert.AreNotEqual(invalidName, viewModel.FileName);
|
||||
|
||||
ImageResizerSettings settings = SettingsUtils.GetSettings<ImageResizerSettings>(Module);
|
||||
Assert.AreNotEqual(invalidName, settings.Properties.ImageresizerFileName.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void KeepDateModified_ShouldUpdateValue_WhenSuccessful()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user