diff options
author | Bob Arnson <bob@firegiant.com> | 2023-03-13 21:20:09 -0400 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-03-13 22:40:22 -0400 |
commit | 68ea7b2f8dccb48d69e8aeb960ce8cb29790e8c4 (patch) | |
tree | 34566b7cc1eb6f99cbdf796227729d9bfd3e3eac /src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs | |
parent | 0d3150d3671e2441661593ffb0fb402f484f7ff6 (diff) | |
download | wix-68ea7b2f8dccb48d69e8aeb960ce8cb29790e8c4.tar.gz wix-68ea7b2f8dccb48d69e8aeb960ce8cb29790e8c4.tar.bz2 wix-68ea7b2f8dccb48d69e8aeb960ce8cb29790e8c4.zip |
Add tests for custom WixUI sets.
Diffstat (limited to '')
-rw-r--r-- | src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs b/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs index 7f9b7313..17eec347 100644 --- a/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs +++ b/src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs | |||
@@ -143,6 +143,7 @@ namespace WixToolsetTest.UI | |||
143 | }, results.Where(r => r.StartsWith("Binary:")).ToArray()); | 143 | }, results.Where(r => r.StartsWith("Binary:")).ToArray()); |
144 | WixAssert.CompareLineByLine(new[] | 144 | WixAssert.CompareLineByLine(new[] |
145 | { | 145 | { |
146 | "CustomAction:SetWIXUI_EXITDIALOGOPTIONALTEXT\t51\tWIXUI_EXITDIALOGOPTIONALTEXT\tThank you for installing [ProductName].\t", | ||
146 | "CustomAction:WixUIPrintEula_X64\t65\tWixUiCa_X64\tPrintEula\t", | 147 | "CustomAction:WixUIPrintEula_X64\t65\tWixUiCa_X64\tPrintEula\t", |
147 | }, results.Where(r => r.StartsWith("CustomAction:")).ToArray()); | 148 | }, results.Where(r => r.StartsWith("CustomAction:")).ToArray()); |
148 | WixAssert.CompareLineByLine(new[] | 149 | WixAssert.CompareLineByLine(new[] |
@@ -152,13 +153,13 @@ namespace WixToolsetTest.UI | |||
152 | } | 153 | } |
153 | 154 | ||
154 | [Fact] | 155 | [Fact] |
155 | public void CanBuildUsingWixUIInstallDir() | 156 | public void CanBuildUsingWixUIInstallDirWithCustomizedEula() |
156 | { | 157 | { |
157 | var folder = TestData.Get(@"TestData", "WixUI_InstallDir"); | 158 | var folder = TestData.Get(@"TestData", "WixUI_InstallDir"); |
158 | var bindFolder = TestData.Get(@"TestData", "data"); | 159 | var bindFolder = TestData.Get(@"TestData", "data"); |
159 | var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder }); | 160 | var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder }); |
160 | 161 | ||
161 | var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent"); | 162 | var results = build.BuildAndQuery(BuildEula, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent"); |
162 | Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t")); | 163 | Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t")); |
163 | WixAssert.CompareLineByLine(new[] | 164 | WixAssert.CompareLineByLine(new[] |
164 | { | 165 | { |
@@ -303,6 +304,82 @@ namespace WixToolsetTest.UI | |||
303 | } | 304 | } |
304 | 305 | ||
305 | [Fact] | 306 | [Fact] |
307 | public void CanBuildUsingWithInstallDirAndRemovedDialog() | ||
308 | { | ||
309 | var folder = TestData.Get(@"TestData", "InstallDir_NoLicense"); | ||
310 | var bindFolder = TestData.Get(@"TestData", "data"); | ||
311 | var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder }); | ||
312 | |||
313 | var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent"); | ||
314 | Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t")); | ||
315 | WixAssert.CompareLineByLine(new[] | ||
316 | { | ||
317 | "Binary:WixUI_Bmp_Banner\t[Binary data]", | ||
318 | "Binary:WixUI_Bmp_Dialog\t[Binary data]", | ||
319 | "Binary:WixUI_Bmp_New\t[Binary data]", | ||
320 | "Binary:WixUI_Bmp_Up\t[Binary data]", | ||
321 | "Binary:WixUI_Ico_Exclam\t[Binary data]", | ||
322 | "Binary:WixUI_Ico_Info\t[Binary data]", | ||
323 | "Binary:WixUiCa_X86\t[Binary data]", | ||
324 | }, results.Where(r => r.StartsWith("Binary:")).ToArray()); | ||
325 | WixAssert.CompareLineByLine(new[] | ||
326 | { | ||
327 | "CustomAction:WixUIValidatePath_X86\t65\tWixUiCa_X86\tValidatePath\t", | ||
328 | }, results.Where(r => r.StartsWith("CustomAction:")).ToArray()); | ||
329 | WixAssert.CompareLineByLine(new[] | ||
330 | { | ||
331 | "Property:WIXUI_INSTALLDIR\tINSTALLFOLDER", | ||
332 | }, results.Where(r => r.StartsWith("Property:WIXUI")).ToArray()); | ||
333 | WixAssert.CompareLineByLine(new[] | ||
334 | { | ||
335 | "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3", | ||
336 | "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2", | ||
337 | }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray()); | ||
338 | |||
339 | Assert.Empty(results.Where(result => result.Contains("LicenseAgreementDlg")).ToArray()); | ||
340 | } | ||
341 | |||
342 | [Fact] | ||
343 | public void CanBuildUsingWithInstallDirAndAddedDialog() | ||
344 | { | ||
345 | var folder = TestData.Get(@"TestData", "InstallDir_SpecialDlg"); | ||
346 | var bindFolder = TestData.Get(@"TestData", "data"); | ||
347 | var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder }); | ||
348 | |||
349 | var results = build.BuildAndQuery(BuildX64, "Binary", "Control", "Dialog", "CustomAction", "Property", "ControlEvent"); | ||
350 | Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t")); | ||
351 | WixAssert.CompareLineByLine(new[] | ||
352 | { | ||
353 | "Binary:WixUI_Bmp_Banner\t[Binary data]", | ||
354 | "Binary:WixUI_Bmp_Dialog\t[Binary data]", | ||
355 | "Binary:WixUI_Bmp_New\t[Binary data]", | ||
356 | "Binary:WixUI_Bmp_Up\t[Binary data]", | ||
357 | "Binary:WixUI_Ico_Exclam\t[Binary data]", | ||
358 | "Binary:WixUI_Ico_Info\t[Binary data]", | ||
359 | "Binary:WixUiCa_X64\t[Binary data]", | ||
360 | }, results.Where(r => r.StartsWith("Binary:")).ToArray()); | ||
361 | WixAssert.CompareLineByLine(new[] | ||
362 | { | ||
363 | "CustomAction:WixUIPrintEula_X64\t65\tWixUiCa_X64\tPrintEula\t", | ||
364 | "CustomAction:WixUIValidatePath_X64\t65\tWixUiCa_X64\tValidatePath\t", | ||
365 | }, results.Where(r => r.StartsWith("CustomAction:")).ToArray()); | ||
366 | WixAssert.CompareLineByLine(new[] | ||
367 | { | ||
368 | "Property:WIXUI_INSTALLDIR\tINSTALLFOLDER", | ||
369 | }, results.Where(r => r.StartsWith("Property:WIXUI")).ToArray()); | ||
370 | WixAssert.CompareLineByLine(new[] | ||
371 | { | ||
372 | "ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t3", | ||
373 | "ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t2", | ||
374 | "ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X64\t1\t1", | ||
375 | }, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray()); | ||
376 | |||
377 | Assert.Equal(8, results.Where(result => result.StartsWith("Control:") && result.Contains("SpecialDlg")).Count()); | ||
378 | Assert.Equal(5, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("SpecialDlg")).Count()); | ||
379 | Assert.Single(results.Where(result => result.StartsWith("Dialog:") && result.Contains("SpecialDlg"))); | ||
380 | } | ||
381 | |||
382 | [Fact] | ||
306 | public void CannotBuildWithV3LikeUIRef() | 383 | public void CannotBuildWithV3LikeUIRef() |
307 | { | 384 | { |
308 | var folder = TestData.Get(@"TestData", "InvalidUIRef"); | 385 | var folder = TestData.Get(@"TestData", "InvalidUIRef"); |
@@ -345,6 +422,12 @@ namespace WixToolsetTest.UI | |||
345 | .AssertSuccess(); | 422 | .AssertSuccess(); |
346 | } | 423 | } |
347 | 424 | ||
425 | private static void BuildEula(string[] args) | ||
426 | { | ||
427 | var result = WixRunner.Execute(args.Concat(new[] { "-bv", "WixUILicenseRtf=bpl.rtf" }).ToArray()) | ||
428 | .AssertSuccess(); | ||
429 | } | ||
430 | |||
348 | private static void BuildInGerman(string[] args) | 431 | private static void BuildInGerman(string[] args) |
349 | { | 432 | { |
350 | var localizedArgs = args.Append("-culture").Append("de-DE").ToArray(); | 433 | var localizedArgs = args.Append("-culture").Append("de-DE").ToArray(); |