@joebigelow / wix / commits / 79cd3cc5

Add tests for the rest of the UI modes.

Sean Hall committed Apr 7, 2020 at 13:20 UTC 79cd3cc53ab71329270c9e171d88cf475d3f7e23
10 files changed +192 -33
src/test/WixToolsetTest.UI/TestData/WixUI_Advanced/Package.wxs new
+29
@@ -0,0 +1,29 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5 +
6 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
7 + <MediaTemplate />
8 +
9 + <Feature Id="ProductFeature" Title="MsiPackage">
10 + <ComponentGroupRef Id="ProductComponents" />
11 + </Feature>
12 +
13 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
14 + <Component>
15 + <File Source="example.txt" />
16 + </Component>
17 + </ComponentGroup>
18 +
19 + <UIRef Id="WixUI_Advanced" />
20 + </Product>
21 +
22 + <Fragment>
23 + <Directory Id="TARGETDIR" Name="SourceDir">
24 + <Directory Id="ProgramFilesFolder">
25 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
26 + </Directory>
27 + </Directory>
28 + </Fragment>
29 +</Wix>
src/test/WixToolsetTest.UI/TestData/WixUI_FeatureTree/Package.wxs new
+29
@@ -0,0 +1,29 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5 +
6 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
7 + <MediaTemplate />
8 +
9 + <Feature Id="ProductFeature" Title="MsiPackage">
10 + <ComponentGroupRef Id="ProductComponents" />
11 + </Feature>
12 +
13 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
14 + <Component>
15 + <File Source="example.txt" />
16 + </Component>
17 + </ComponentGroup>
18 +
19 + <UIRef Id="WixUI_FeatureTree" />
20 + </Product>
21 +
22 + <Fragment>
23 + <Directory Id="TARGETDIR" Name="SourceDir">
24 + <Directory Id="ProgramFilesFolder">
25 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
26 + </Directory>
27 + </Directory>
28 + </Fragment>
29 +</Wix>
src/test/WixToolsetTest.UI/TestData/WixUI_InstallDir/Package.wxs new
+29
@@ -0,0 +1,29 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5 +
6 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
7 + <MediaTemplate />
8 +
9 + <Feature Id="ProductFeature" Title="MsiPackage">
10 + <ComponentGroupRef Id="ProductComponents" />
11 + </Feature>
12 +
13 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
14 + <Component>
15 + <File Source="example.txt" />
16 + </Component>
17 + </ComponentGroup>
18 +
19 + <UIRef Id="WixUI_InstallDir" />
20 + </Product>
21 +
22 + <Fragment>
23 + <Directory Id="TARGETDIR" Name="SourceDir">
24 + <Directory Id="ProgramFilesFolder">
25 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
26 + </Directory>
27 + </Directory>
28 + </Fragment>
29 +</Wix>
src/test/WixToolsetTest.UI/TestData/WixUI_Minimal/Package.en-us.wxl deleted
-11
@@ -1,11 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -
3 -<!--
4 -This file contains the declaration of all the localizable strings.
5 --->
6 -<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7 -
8 - <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 - <String Id="FeatureTitle">MsiPackage</String>
10 -
11 -</WixLocalization>
src/test/WixToolsetTest.UI/TestData/WixUI_Minimal/Package.wxs
+10 -3
@@ -3,13 +3,20 @@
3 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5
6 - <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
6 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
7 <MediaTemplate />
8
9 - <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
9 + <Feature Id="ProductFeature" Title="MsiPackage">
10 <ComponentGroupRef Id="ProductComponents" />
11 </Feature>
12 -
12 +
13 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
14 + <Component>
15 + <File Source="example.txt" />
16 + </Component>
17 + </ComponentGroup>
18 +
19 + <UIRef Id="WixUI_Minimal" />
20 </Product>
21
22 <Fragment>
src/test/WixToolsetTest.UI/TestData/WixUI_Minimal/PackageComponents.wxs deleted
-12
@@ -1,12 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 - <Fragment>
4 - <UIRef Id="WixUI_Minimal" />
5 -
6 - <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
7 - <Component>
8 - <File Source="example.txt" />
9 - </Component>
10 - </ComponentGroup>
11 - </Fragment>
12 -</Wix>
src/test/WixToolsetTest.UI/TestData/WixUI_Mondo/Package.wxs new
+29
@@ -0,0 +1,29 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 + <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5 +
6 + <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
7 + <MediaTemplate />
8 +
9 + <Feature Id="ProductFeature" Title="MsiPackage">
10 + <ComponentGroupRef Id="ProductComponents" />
11 + </Feature>
12 +
13 + <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
14 + <Component>
15 + <File Source="example.txt" />
16 + </Component>
17 + </ComponentGroup>
18 +
19 + <UIRef Id="WixUI_Mondo" />
20 + </Product>
21 +
22 + <Fragment>
23 + <Directory Id="TARGETDIR" Name="SourceDir">
24 + <Directory Id="ProgramFilesFolder">
25 + <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
26 + </Directory>
27 + </Directory>
28 + </Fragment>
29 +</Wix>
src/test/WixToolsetTest.UI/TestData/data/example.txt renamed
src/test/WixToolsetTest.UI/UIExtensionFixture.cs
+61 -4
@@ -10,17 +10,74 @@ namespace WixToolsetTest.UI
10
11 public class UIExtensionFixture
12 {
13 - [Fact(Skip = "Currently fails")]
13 + [Fact(Skip = "WixUI_Advanced is missing because it can't currently compile in v4")]
14 + public void CanBuildUsingWixUIAdvanced()
15 + {
16 + var folder = TestData.Get(@"TestData\WixUI_Advanced");
17 + var bindFolder = TestData.Get(@"TestData\data");
18 + var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
19 +
20 + var results = build.BuildAndQuery(Build, "Property");
21 + Assert.Equal(new[]
22 + {
23 + "Property:WixUI_Mode\tAdvanced",
24 + }, results.Where(s => s.StartsWith("Property:WixUI_Mode")).ToArray());
25 + }
26 +
27 + [Fact]
28 + public void CanBuildUsingWixUIFeatureTree()
29 + {
30 + var folder = TestData.Get(@"TestData\WixUI_FeatureTree");
31 + var bindFolder = TestData.Get(@"TestData\data");
32 + var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
33 +
34 + var results = build.BuildAndQuery(Build, "Property");
35 + Assert.Equal(new[]
36 + {
37 + "Property:WixUI_Mode\tFeatureTree",
38 + }, results.Where(s => s.StartsWith("Property:WixUI_Mode")).ToArray());
39 + }
40 +
41 + [Fact]
42 + public void CanBuildUsingWixUIInstallDir()
43 + {
44 + var folder = TestData.Get(@"TestData\WixUI_InstallDir");
45 + var bindFolder = TestData.Get(@"TestData\data");
46 + var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
47 +
48 + var results = build.BuildAndQuery(Build, "Property");
49 + Assert.Equal(new[]
50 + {
51 + "Property:WixUI_Mode\tInstallDir",
52 + }, results.Where(s => s.StartsWith("Property:WixUI_Mode")).ToArray());
53 + }
54 +
55 + [Fact]
56 public void CanBuildUsingWixUIMinimal()
57 {
58 var folder = TestData.Get(@"TestData\WixUI_Minimal");
17 - var build = new Builder(folder, typeof(UIExtensionFactory), new[] { folder });
59 + var bindFolder = TestData.Get(@"TestData\data");
60 + var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
61 +
62 + var results = build.BuildAndQuery(Build, "Property");
63 + Assert.Equal(new[]
64 + {
65 + "Property:WixUI_Mode\tMinimal",
66 + }, results.Where(s => s.StartsWith("Property:WixUI_Mode")).ToArray());
67 + }
68 +
69 + [Fact]
70 + public void CanBuildUsingWixUIMondo()
71 + {
72 + var folder = TestData.Get(@"TestData\WixUI_Mondo");
73 + var bindFolder = TestData.Get(@"TestData\data");
74 + var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });
75
76 var results = build.BuildAndQuery(Build, "Property");
77 Assert.Equal(new[]
78 {
22 - "Property:",
23 - }, results.OrderBy(s => s).ToArray());
79 + "Property:WixUI_Mode\tMondo",
80 + }, results.Where(s => s.StartsWith("Property:WixUI_Mode")).ToArray());
81 }
82
83 private static void Build(string[] args)
src/test/WixToolsetTest.UI/WixToolsetTest.UI.csproj
+5 -3
@@ -12,10 +12,12 @@
12 </PropertyGroup>
13
14 <ItemGroup>
15 - <Content Include="TestData\WixUI_Minimal\example.txt" CopyToOutputDirectory="PreserveNewest" />
16 - <Content Include="TestData\WixUI_Minimal\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
15 + <Content Include="TestData\data\example.txt" CopyToOutputDirectory="PreserveNewest" />
16 + <Content Include="TestData\WixUI_Advanced\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
17 + <Content Include="TestData\WixUI_FeatureTree\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
18 + <Content Include="TestData\WixUI_InstallDir\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
19 <Content Include="TestData\WixUI_Minimal\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
18 - <Content Include="TestData\WixUI_Minimal\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
20 + <Content Include="TestData\WixUI_Mondo\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
21 </ItemGroup>
22
23 <ItemGroup>