aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2020-12-09 15:59:21 -0500
committerBob Arnson <bob@firegiant.com>2020-12-09 16:04:24 -0500
commite2f9e3cdc8e37693121fbc0ce61bdd325cbec626 (patch)
treed4aeb23d3b1720758d6e11b4de4a59bb5366cc7d
parent0e1f5a4fcf29f979a1b6e6b67bfd2a2b0e6f4a3c (diff)
downloadwix-e2f9e3cdc8e37693121fbc0ce61bdd325cbec626.tar.gz
wix-e2f9e3cdc8e37693121fbc0ce61bdd325cbec626.tar.bz2
wix-e2f9e3cdc8e37693121fbc0ce61bdd325cbec626.zip
Add test to verify primary feature select in component categories.
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs33
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.wxs36
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj3
5 files changed, 84 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
index 6409676e..11b1703c 100644
--- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
@@ -1004,5 +1004,38 @@ namespace WixToolsetTest.CoreIntegration
1004 }, files.Select(f => f.Name).ToArray()); 1004 }, files.Select(f => f.Name).ToArray());
1005 } 1005 }
1006 } 1006 }
1007
1008 [Fact]
1009 public void CanPublishComponentWithMultipleFeatureComponents()
1010 {
1011 var folder = TestData.Get(@"TestData\PublishComponent");
1012
1013 using (var fs = new DisposableFileSystem())
1014 {
1015 var baseFolder = fs.GetFolder();
1016 var intermediateFolder = Path.Combine(baseFolder, "obj");
1017 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
1018
1019 var result = WixRunner.Execute(new[]
1020 {
1021 "build",
1022 Path.Combine(folder, "Package.wxs"),
1023 "-loc", Path.Combine(folder, "Package.en-us.wxl"),
1024 "-bindpath", Path.Combine(folder, "data"),
1025 "-intermediateFolder", intermediateFolder,
1026 "-o", msiPath
1027 });
1028
1029 result.AssertSuccess();
1030
1031 Assert.True(File.Exists(msiPath));
1032 var results = Query.QueryDatabase(msiPath, new[] { "PublishComponent" });
1033 WixAssert.CompareLineByLine(new[]
1034 {
1035 "PublishComponent:{0A82C8F6-9CE9-4336-B8BE-91A39B5F7081} Qualifier2 Component2 AppData2 ProductFeature2",
1036 "PublishComponent:{BD245B5A-EC33-46ED-98FF-E9D3D416AD04} Qualifier1 Component1 AppData1 ProductFeature1",
1037 }, results);
1038 }
1039 }
1007 } 1040 }
1008} 1041}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.en-us.wxl
new file mode 100644
index 00000000..38c12ac1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.en-us.wxl
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This 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>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.wxs
new file mode 100644
index 00000000..6a95e9da
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.wxs
@@ -0,0 +1,36 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Name="MsiPackage" Codepage="1252" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" Compressed="no" InstallerVersion="200" Scope="perMachine">
3 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
4
5 <Feature Id="ProductFeature1" Title="!(loc.FeatureTitle)">
6 <ComponentRef Id="Component1" Primary="yes" />
7 </Feature>
8
9 <Feature Id="ProductFeature2" Title="!(loc.FeatureTitle)">
10 <ComponentRef Id="Component1" />
11 <ComponentRef Id="Component2" />
12 </Feature>
13 </Package>
14
15 <Fragment>
16 <Directory Id="TARGETDIR" Name="SourceDir">
17 <Directory Id="ProgramFilesFolder">
18 <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
19 </Directory>
20 </Directory>
21 </Fragment>
22
23 <Fragment>
24 <Component Id="Component1" Directory="INSTALLFOLDER" Guid="C8EFA5DF-2876-4724-A003-A6BEBF140BB1">
25 <File Id="File1" Source="test.txt" />
26 <Category Id="{BD245B5A-EC33-46ED-98FF-E9D3D416AD04}" AppData="AppData1" Qualifier="Qualifier1" />
27 </Component>
28 </Fragment>
29
30 <Fragment>
31 <Component Id="Component2" Directory="INSTALLFOLDER" Guid="8DE79DE7-4B55-4D43-88F5-AD6A1E8D242A">
32 <File Id="File2" Source="test.txt" />
33 <Category Id="{0A82C8F6-9CE9-4336-B8BE-91A39B5F7081}" AppData="AppData2" Qualifier="Qualifier2" />
34 </Component>
35 </Fragment>
36</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/data/test.txt
new file mode 100644
index 00000000..cd0db0e1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/data/test.txt
@@ -0,0 +1 @@
This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 6c494169..ff04e65f 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -210,6 +210,9 @@
210 <Content Include="TestData\DecompileNullComponent\example.cab" CopyToOutputDirectory="PreserveNewest" /> 210 <Content Include="TestData\DecompileNullComponent\example.cab" CopyToOutputDirectory="PreserveNewest" />
211 <Content Include="TestData\DecompileNullComponent\example.msi" CopyToOutputDirectory="PreserveNewest" /> 211 <Content Include="TestData\DecompileNullComponent\example.msi" CopyToOutputDirectory="PreserveNewest" />
212 <Content Include="TestData\DecompileNullComponent\Expected.wxs" CopyToOutputDirectory="PreserveNewest" /> 212 <Content Include="TestData\DecompileNullComponent\Expected.wxs" CopyToOutputDirectory="PreserveNewest" />
213 <Content Include="TestData\PublishComponent\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
214 <Content Include="TestData\PublishComponent\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
215 <Content Include="TestData\PublishComponent\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
213 </ItemGroup> 216 </ItemGroup>
214 217
215 <ItemGroup> 218 <ItemGroup>