@joebigelow / wix-1 / commits / e2f9e3cd

Add test to verify primary feature select in component categories.

Bob Arnson committed Dec 9, 2020 at 15:59 UTC e2f9e3cdc8e37693121fbc0ce61bdd325cbec626
5 files changed +84
src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+33
@@ -1004,5 +1004,38 @@ namespace WixToolsetTest.CoreIntegration
1004 }, files.Select(f => f.Name).ToArray());
1005 }
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 + }
1040 }
1041 }
src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/Package.en-us.wxl new
+11
@@ -0,0 +1,11 @@
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.CoreIntegration/TestData/PublishComponent/Package.wxs new
+36
@@ -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>
src/test/WixToolsetTest.CoreIntegration/TestData/PublishComponent/data/test.txt new
+1
@@ -0,0 +1 @@
1 +This is test.txt.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+3
@@ -210,6 +210,9 @@
210 <Content Include="TestData\DecompileNullComponent\example.cab" CopyToOutputDirectory="PreserveNewest" />
211 <Content Include="TestData\DecompileNullComponent\example.msi" 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" />
216 </ItemGroup>
217
218 <ItemGroup>