@@ -24,6 +24,9 @@ namespace Test::PickerCommonTests
24
24
{
25
25
class PickerCommonTests
26
26
{
27
+ private:
28
+ static const wchar_t s_rawStringWithNull[];
29
+ static const winrt::hstring s_embeddedNullString;
27
30
public:
28
31
BEGIN_TEST_CLASS (PickerCommonTests)
29
32
TEST_CLASS_PROPERTY (L" ThreadingModel" , L" MTA" ) // MTA is required for ::Test::Bootstrap::SetupPackages()
@@ -392,7 +395,7 @@ namespace Test::PickerCommonTests
392
395
// Arrange.
393
396
auto test_cases = std::vector<std::tuple<winrt::hstring, bool >>{
394
397
{L" validFileName.txt" , true }, // Valid file name
395
- {L" in \0 valid.txt " , false }, // embedded null
398
+ {s_embeddedNullString , false }, // embedded null
396
399
{L" " , true }, // Allow Empty string
397
400
{L" validFileNameWithSpaces .txt" , true },// Allow spaces
398
401
{
@@ -435,7 +438,7 @@ namespace Test::PickerCommonTests
435
438
{L" Valid" , true }, // Valid commit button text
436
439
{L" " , true }, // Allow empty string
437
440
{L" Valid Text" , true }, // Allow spaces
438
- {L" Invalid \0 Text " , false }, // Embedded null is invalid
441
+ {s_embeddedNullString , false }, // Embedded null is invalid
439
442
};
440
443
441
444
TEST_METHOD (VerifyFolderPicker_ValidateCommitButtonText)
@@ -769,4 +772,8 @@ namespace Test::PickerCommonTests
769
772
}
770
773
771
774
};
775
+
776
+ const wchar_t PickerCommonTests::s_rawStringWithNull[] = L" in\0 valid.txt" ;
777
+ const winrt::hstring PickerCommonTests::s_embeddedNullString{ std::wstring_view (s_rawStringWithNull, 12 ) };
778
+
772
779
}
0 commit comments