@@ -237,6 +237,35 @@ namespace Test::PickerCommonTests
237
237
L" *.png;*.jpg;*.jpeg;*.bmp" );
238
238
}
239
239
240
+ TEST_METHOD (VerifyFilters_FileSavePickerWhenUnionChoicesExpectMatchingSpec)
241
+ {
242
+ // Arrange.
243
+ winrt::Microsoft::UI::WindowId windowId{};
244
+ winrt::Microsoft::Windows::Storage::Pickers::FileSavePicker picker (windowId);
245
+
246
+ picker.FileTypeChoices ().Insert (
247
+ L" Documents" , winrt::single_threaded_vector<winrt::hstring>({ L" .txt" , L" .doc" , L" .docx" }));
248
+ picker.FileTypeChoices ().Insert (
249
+ L" Pictures" , winrt::single_threaded_vector<winrt::hstring>({ L" .png" , L" .jpg" , L" .jpeg" , L" .bmp" }));
250
+
251
+ // Act.
252
+ PickerParameters parameters{};
253
+ parameters.CaptureFilterSpec (picker.FileTypeChoices ().GetView (), true );
254
+
255
+ // Assert.
256
+ VERIFY_ARE_EQUAL (parameters.FileTypeFilterPara .size (), 3 );
257
+
258
+ VERIFY_ARE_EQUAL (
259
+ std::wstring (parameters.FileTypeFilterPara [0 ].pszSpec ),
260
+ L" *.txt;*.doc;*.docx" );
261
+ VERIFY_ARE_EQUAL (
262
+ std::wstring (parameters.FileTypeFilterPara [1 ].pszSpec ),
263
+ L" *.png;*.jpg;*.jpeg;*.bmp" );
264
+ VERIFY_ARE_EQUAL (
265
+ std::wstring (parameters.FileTypeFilterPara [2 ].pszSpec ),
266
+ L" *.txt;*.doc;*.docx;*.png;*.jpg;*.jpeg;*.bmp" );
267
+ }
268
+
240
269
TEST_METHOD (VerifyFilters_FileSavePickerWhenNoFileTypeChoicesDefinedExpectAsteriskSpec)
241
270
{
242
271
// Note that is is a different behavior than the UWP pickers, where FileTypeChoices are required.
0 commit comments