@joebigelow / wix / commits / 7c04bfdb

Fix bugs when compiling UI.wixext

Sean Hall committed Apr 7, 2020 at 11:20 UTC 7c04bfdb54ccf5b4b67995c9715a3f7f9e454206
11 files changed +123 -87
src/WixToolset.Core.WindowsInstaller/Data/tables.xml
+1 -1
@@ -165,7 +165,7 @@
165 <columnDefinition name="Signature_" type="string" length="72" primaryKey="yes"
166 keyTable="Signature;RegLocator;IniLocator;DrLocator;CompLocator" keyColumn="1" category="identifier" description="The Signature_ represents a unique file signature and is also the foreign key in the Signature, RegLocator, IniLocator, CompLocator and the DrLocator tables."/>
167 </tableDefinition>
168 - <tableDefinition name="CheckBox" createSymbols="yes">
168 + <tableDefinition name="CheckBox" createSymbols="yes" tupleIdIsPrimaryKey="no">
169 <columnDefinition name="Property" type="string" length="72" primaryKey="yes" modularize="column"
170 category="identifier" description="A named property to be tied to the item."/>
171 <columnDefinition name="Value" type="string" length="64" nullable="yes" modularize="property"
src/WixToolset.Core/Compiler.cs
+1 -1
@@ -6295,7 +6295,7 @@ namespace WixToolset.Core
6295 case "default":
6296 action = "Default";
6297 break;
6298 - case "disnable":
6298 + case "disable":
6299 action = "Disable";
6300 break;
6301 case "enable":
src/WixToolset.Core/Compiler_UI.cs
+18 -16
@@ -465,12 +465,12 @@ namespace WixToolset.Core
465 {
466 case "Control":
467 // These are all thrown away.
468 - IntermediateTuple lastTabRow = null;
468 + ControlTuple lastTabTuple = null;
469 string firstControl = null;
470 string defaultControl = null;
471 string cancelControl = null;
472
473 - this.ParseControlElement(child, id.Id, TupleDefinitionType.BBControl, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl);
473 + this.ParseControlElement(child, id.Id, TupleDefinitionType.BBControl, ref lastTabTuple, ref firstControl, ref defaultControl, ref cancelControl);
474 break;
475 default:
476 this.Core.UnexpectedElement(node, child);
@@ -954,7 +954,7 @@ namespace WixToolset.Core
954 id = Identifier.Invalid;
955 }
956
957 - IntermediateTuple lastTabRow = null;
957 + ControlTuple lastTabTuple = null;
958 string cancelControl = null;
959 string defaultControl = null;
960 string firstControl = null;
@@ -966,7 +966,7 @@ namespace WixToolset.Core
966 switch (child.Name.LocalName)
967 {
968 case "Control":
969 - this.ParseControlElement(child, id.Id, TupleDefinitionType.Control, ref lastTabRow, ref firstControl, ref defaultControl, ref cancelControl);
969 + this.ParseControlElement(child, id.Id, TupleDefinitionType.Control, ref lastTabTuple, ref firstControl, ref defaultControl, ref cancelControl);
970 break;
971 default:
972 this.Core.UnexpectedElement(node, child);
@@ -979,11 +979,11 @@ namespace WixToolset.Core
979 }
980 }
981
982 - if (null != lastTabRow && null != lastTabRow[1])
982 + if (null != lastTabTuple && null != lastTabTuple.Control)
983 {
984 - if (firstControl != lastTabRow[1].ToString())
984 + if (firstControl != lastTabTuple.Control)
985 {
986 - lastTabRow.Set(10, firstControl);
986 + lastTabTuple.NextControlRef = firstControl;
987 }
988 }
989
@@ -1027,12 +1027,12 @@ namespace WixToolset.Core
1027 /// <param name="node">Element to parse.</param>
1028 /// <param name="dialog">Identifier for parent dialog.</param>
1029 /// <param name="table">Table control belongs in.</param>
1030 - /// <param name="lastTabTuple">Last row in the tab order.</param>
1030 + /// <param name="lastTabTuple">Last control in the tab order.</param>
1031 /// <param name="firstControl">Name of the first control in the tab order.</param>
1032 /// <param name="defaultControl">Name of the default control.</param>
1033 /// <param name="cancelControl">Name of the candle control.</param>
1034 /// <param name="trackDiskSpace">True if the containing dialog tracks disk space.</param>
1035 - private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tupleType, ref IntermediateTuple lastTabTuple, ref string firstControl, ref string defaultControl, ref string cancelControl)
1035 + private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tupleType, ref ControlTuple lastTabTuple, ref string firstControl, ref string defaultControl, ref string cancelControl)
1036 {
1037 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
1038 Identifier controlId = null;
@@ -1529,7 +1529,15 @@ namespace WixToolset.Core
1529
1530 if (!notTabbable)
1531 {
1532 - if (TupleDefinitionType.BBControl == tupleType)
1532 + if (tuple is ControlTuple controlTuple)
1533 + {
1534 + if (null != lastTabTuple)
1535 + {
1536 + lastTabTuple.NextControlRef = controlTuple.Control;
1537 + }
1538 + lastTabTuple = controlTuple;
1539 + }
1540 + else if (tuple != null)
1541 {
1542 this.Core.Write(ErrorMessages.TabbableControlNotAllowedInBillboard(sourceLineNumbers, node.Name.LocalName, controlType));
1543 }
@@ -1538,12 +1546,6 @@ namespace WixToolset.Core
1546 {
1547 firstControl = controlId.Id;
1548 }
1541 -
1542 - if (null != lastTabTuple)
1543 - {
1544 - lastTabTuple.Set(10, controlId.Id);
1545 - }
1546 - lastTabTuple = tuple;
1549 }
1550
1551 // bitmap and icon controls contain a foreign key into the binary table in the text column;
src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
-41
@@ -214,47 +214,6 @@ namespace WixToolsetTest.CoreIntegration
214 }
215 }
216
217 - [Fact(Skip = "Currently fails")]
218 - public void CanBuildDialogsInInstallUISequence()
219 - {
220 - var folder = TestData.Get(@"TestData\DialogsInInstallUISequence");
221 -
222 - using (var fs = new DisposableFileSystem())
223 - {
224 - var baseFolder = fs.GetFolder();
225 - var intermediateFolder = Path.Combine(baseFolder, "obj");
226 -
227 - var result = WixRunner.Execute(new[]
228 - {
229 - "build",
230 - Path.Combine(folder, "Package.wxs"),
231 - Path.Combine(folder, "PackageComponents.wxs"),
232 - "-loc", Path.Combine(folder, "Package.en-us.wxl"),
233 - "-bindpath", Path.Combine(folder, "data"),
234 - "-intermediateFolder", intermediateFolder,
235 - "-o", Path.Combine(baseFolder, @"bin\test.msi")
236 - });
237 -
238 - result.AssertSuccess();
239 -
240 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
241 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
242 - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt")));
243 -
244 - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
245 - var section = intermediate.Sections.Single();
246 -
247 - var textStyle = section.Tuples.OfType<TextStyleTuple>().Single();
248 - Assert.Equal("Tahoma", textStyle.FaceName);
249 - Assert.Equal(8, textStyle.Size);
250 -
251 - var installUIActions = section.Tuples.OfType<WixActionTuple>()
252 - .Where(t => t.SequenceTable == SequenceTable.InstallUISequence)
253 - .ToList();
254 - Assert.Equal(10, installUIActions.Count);
255 - }
256 - }
257 -
217 [Fact]
218 public void CanBuildWithErrorTable()
219 {
src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+82
@@ -254,6 +254,54 @@ namespace WixToolsetTest.CoreIntegration
254 }
255 }
256
257 + [Fact]
258 + public void PopulatesControlTables()
259 + {
260 + var folder = TestData.Get(@"TestData");
261 +
262 + using (var fs = new DisposableFileSystem())
263 + {
264 + var baseFolder = fs.GetFolder();
265 + var intermediateFolder = Path.Combine(baseFolder, "obj");
266 + var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
267 +
268 + var result = WixRunner.Execute(new[]
269 + {
270 + "build",
271 + Path.Combine(folder, "DialogsInInstallUISequence", "PackageComponents.wxs"),
272 + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
273 + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
274 + "-bindpath", Path.Combine(folder, "SingleFile", "data"),
275 + "-intermediateFolder", intermediateFolder,
276 + "-o", msiPath,
277 + });
278 +
279 + result.AssertSuccess();
280 +
281 + Assert.True(File.Exists(msiPath));
282 +
283 + var results = Query.QueryDatabase(msiPath, new[] { "CheckBox", "Control", "InstallUISequence" });
284 + Assert.Equal(new[]
285 + {
286 + "CheckBox:WIXUI_EXITDIALOGOPTIONALCHECKBOX\t1",
287 + "Control:FirstDialog\tHeader\tText\t0\t13\t90\t13\t3\tFirstDialogHeader\tTitle\t\t",
288 + "Control:FirstDialog\tTitle\tText\t0\t0\t90\t13\t3\tFirstDialogTitle\tHeader\t\t",
289 + "Control:SecondDialog\tOptionalCheckBox\tCheckBox\t0\t13\t100\t40\t2\t[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]\tTitle\t\t",
290 + "Control:SecondDialog\tTitle\tText\t0\t0\t90\t13\t3\tSecondDialogTitle\tOptionalCheckBox\t\t",
291 + "InstallUISequence:CostFinalize\t\t1000",
292 + "InstallUISequence:CostInitialize\t\t800",
293 + "InstallUISequence:ExecuteAction\t\t1300",
294 + "InstallUISequence:FileCost\t\t900",
295 + "InstallUISequence:FindRelatedProducts\t\t25",
296 + "InstallUISequence:FirstDialog\tInstalled AND PATCH\t1298",
297 + "InstallUISequence:LaunchConditions\t\t100",
298 + "InstallUISequence:MigrateFeatureStates\t\t1200",
299 + "InstallUISequence:SecondDialog\tNOT Installed\t1299",
300 + "InstallUISequence:ValidateProductID\t\t700",
301 + }, results);
302 + }
303 + }
304 +
305 [Fact]
306 public void PopulatesCreateFolderTableForNullKeypathComponents()
307 {
@@ -982,6 +1030,40 @@ namespace WixToolsetTest.CoreIntegration
1030 }
1031 }
1032
1033 + [Fact(Skip = "Test demonstrates failure")]
1034 + public void PopulatesTextStyleTableWhenSizeIsLocalized()
1035 + {
1036 + var folder = TestData.Get(@"TestData");
1037 +
1038 + using (var fs = new DisposableFileSystem())
1039 + {
1040 + var baseFolder = fs.GetFolder();
1041 + var intermediateFolder = Path.Combine(baseFolder, "obj");
1042 + var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
1043 +
1044 + var result = WixRunner.Execute(new[]
1045 + {
1046 + "build",
1047 + Path.Combine(folder, "TextStyle", "SizeLocalized.wxs"),
1048 + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
1049 + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
1050 + "-loc", Path.Combine(folder, "TextStyle", "SizeLocalized.en-us.wxl"),
1051 + "-bindpath", Path.Combine(folder, "SingleFile", "data"),
1052 + "-intermediateFolder", intermediateFolder,
1053 + "-o", msiPath,
1054 + });
1055 +
1056 + result.AssertSuccess();
1057 +
1058 + Assert.True(File.Exists(msiPath));
1059 + var results = Query.QueryDatabase(msiPath, new[] { "TextStyle" });
1060 + Assert.Equal(new[]
1061 + {
1062 + "TextStyle:CustomFont\tTahoma\t8\t\t",
1063 + }, results);
1064 + }
1065 + }
1066 +
1067 [Fact]
1068 public void PopulatesTypeLibTableWhenLanguageIsZero()
1069 {
src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.wxs deleted
-21
@@ -1,21 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 - <Product Id="*" Name="MsiPackage" Codepage="1252" 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)" />
7 - <MediaTemplate />
8 -
9 - <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
10 - <ComponentGroupRef Id="ProductComponents" />
11 - </Feature>
12 - </Product>
13 -
14 - <Fragment>
15 - <Directory Id="TARGETDIR" Name="SourceDir">
16 - <Directory Id="ProgramFilesFolder">
17 - <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
18 - </Directory>
19 - </Directory>
20 - </Fragment>
21 -</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/PackageComponents.wxs
+7 -3
@@ -2,17 +2,21 @@
2 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <UI Id="CustomDialog">
5 - <!-- TODO: compiler can't handle loc strings for number fields -->
6 - <TextStyle Id="CustomFont" FaceName="!(loc.CustomFontName)" Size="!(loc.CustomFontSize)" />
5 <Dialog Id="FirstDialog" Width="100" Height="100">
6 <Control Id="Title" Type="Text" X="0" Y="0" Width="90" Height="13" TabSkip="no" Text="FirstDialogTitle" />
7 + <Control Id="Header" Type="Text" X="0" Y="13" Width="90" Height="13" TabSkip="no" Text="FirstDialogHeader">
8 + <Condition Action="hide">Installed</Condition>
9 + <Condition Action="disable">Installed</Condition>
10 + </Control>
11 </Dialog>
12 <Dialog Id="SecondDialog" Width="100" Height="100">
13 <Control Id="Title" Type="Text" X="0" Y="0" Width="90" Height="13" TabSkip="no" Text="SecondDialogTitle" />
14 + <Control Id="OptionalCheckBox" Type="CheckBox" X="0" Y="13" Width="100" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
15 + <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
16 + </Control>
17 </Dialog>
18
19 <InstallUISequence>
15 - <!-- TODO: overriding this currently causes a duplicate symbol error -->
20 <Show Dialog="SecondDialog" Before="FirstDialog" Overridable="yes">NOT Installed</Show>
21 </InstallUISequence>
22 </UI>
src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/data/test.txt deleted
-1
@@ -1 +0,0 @@
1 -This is test.txt.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.en-us.wxl renamed
src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.wxs new
+12
@@ -0,0 +1,12 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Fragment>
4 + <ComponentGroup Id="ProductComponents">
5 + <ComponentGroupRef Id="MinimalComponentGroup"></ComponentGroupRef>
6 + </ComponentGroup>
7 +
8 + <UI Id="CustomUI">
9 + <TextStyle Id="CustomFont" FaceName="!(loc.CustomFontName)" Size="!(loc.CustomFontSize)" />
10 + </UI>
11 + </Fragment>
12 +</Wix>
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+2 -3
@@ -34,9 +34,6 @@
34 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" />
35 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" />
36 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" />
37 - <Content Include="TestData\DialogsInInstallUISequence\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
38 - <Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
39 - <Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
37 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
38 <Content Include="TestData\EnsureTable\EnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" />
39 <Content Include="TestData\Environment\Environment.wxs" CopyToOutputDirectory="PreserveNewest" />
@@ -157,6 +154,8 @@
154 <Content Include="TestData\OverridableActions\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
155 <Content Include="TestData\OverridableActions\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
156 <Content Include="TestData\TextStyle\ColorNull.wxs" CopyToOutputDirectory="PreserveNewest" />
157 + <Content Include="TestData\TextStyle\SizeLocalized.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
158 + <Content Include="TestData\TextStyle\SizeLocalized.wxs" CopyToOutputDirectory="PreserveNewest" />
159 <Content Include="TestData\TypeLib\Language0.wxs" CopyToOutputDirectory="PreserveNewest" />
160 <Content Include="TestData\Wixipl\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
161 <Content Include="TestData\Wixipl\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />