From 7c04bfdb54ccf5b4b67995c9715a3f7f9e454206 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 7 Apr 2020 11:20:36 +1000 Subject: Fix bugs when compiling UI.wixext --- .../Data/tables.xml | 2 +- src/WixToolset.Core/Compiler.cs | 2 +- src/WixToolset.Core/Compiler_UI.cs | 34 ++++----- .../WixToolsetTest.CoreIntegration/MsiFixture.cs | 41 ----------- .../MsiQueryFixture.cs | 82 ++++++++++++++++++++++ .../DialogsInInstallUISequence/Package.en-us.wxl | 13 ---- .../DialogsInInstallUISequence/Package.wxs | 21 ------ .../PackageComponents.wxs | 10 ++- .../DialogsInInstallUISequence/data/test.txt | 1 - .../TestData/TextStyle/SizeLocalized.en-us.wxl | 13 ++++ .../TestData/TextStyle/SizeLocalized.wxs | 12 ++++ .../WixToolsetTest.CoreIntegration.csproj | 5 +- 12 files changed, 136 insertions(+), 100 deletions(-) delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.en-us.wxl delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.wxs delete mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/data/test.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.en-us.wxl create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.wxs diff --git a/src/WixToolset.Core.WindowsInstaller/Data/tables.xml b/src/WixToolset.Core.WindowsInstaller/Data/tables.xml index e28e39c2..a0c7ff55 100644 --- a/src/WixToolset.Core.WindowsInstaller/Data/tables.xml +++ b/src/WixToolset.Core.WindowsInstaller/Data/tables.xml @@ -165,7 +165,7 @@ - + Element to parse. /// Identifier for parent dialog. /// Table control belongs in. - /// Last row in the tab order. + /// Last control in the tab order. /// Name of the first control in the tab order. /// Name of the default control. /// Name of the candle control. /// True if the containing dialog tracks disk space. - private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tupleType, ref IntermediateTuple lastTabTuple, ref string firstControl, ref string defaultControl, ref string cancelControl) + private void ParseControlElement(XElement node, string dialog, TupleDefinitionType tupleType, ref ControlTuple lastTabTuple, ref string firstControl, ref string defaultControl, ref string cancelControl) { var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); Identifier controlId = null; @@ -1529,7 +1529,15 @@ namespace WixToolset.Core if (!notTabbable) { - if (TupleDefinitionType.BBControl == tupleType) + if (tuple is ControlTuple controlTuple) + { + if (null != lastTabTuple) + { + lastTabTuple.NextControlRef = controlTuple.Control; + } + lastTabTuple = controlTuple; + } + else if (tuple != null) { this.Core.Write(ErrorMessages.TabbableControlNotAllowedInBillboard(sourceLineNumbers, node.Name.LocalName, controlType)); } @@ -1538,12 +1546,6 @@ namespace WixToolset.Core { firstControl = controlId.Id; } - - if (null != lastTabTuple) - { - lastTabTuple.Set(10, controlId.Id); - } - lastTabTuple = tuple; } // bitmap and icon controls contain a foreign key into the binary table in the text column; diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index ad24f346..64b3fa93 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs @@ -214,47 +214,6 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact(Skip = "Currently fails")] - public void CanBuildDialogsInInstallUISequence() - { - var folder = TestData.Get(@"TestData\DialogsInInstallUISequence"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var intermediateFolder = Path.Combine(baseFolder, "obj"); - - var result = WixRunner.Execute(new[] - { - "build", - Path.Combine(folder, "Package.wxs"), - Path.Combine(folder, "PackageComponents.wxs"), - "-loc", Path.Combine(folder, "Package.en-us.wxl"), - "-bindpath", Path.Combine(folder, "data"), - "-intermediateFolder", intermediateFolder, - "-o", Path.Combine(baseFolder, @"bin\test.msi") - }); - - result.AssertSuccess(); - - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); - Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt"))); - - var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir")); - var section = intermediate.Sections.Single(); - - var textStyle = section.Tuples.OfType().Single(); - Assert.Equal("Tahoma", textStyle.FaceName); - Assert.Equal(8, textStyle.Size); - - var installUIActions = section.Tuples.OfType() - .Where(t => t.SequenceTable == SequenceTable.InstallUISequence) - .ToList(); - Assert.Equal(10, installUIActions.Count); - } - } - [Fact] public void CanBuildWithErrorTable() { diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 9462c4ff..bb44395f 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -254,6 +254,54 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void PopulatesControlTables() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "DialogsInInstallUISequence", "PackageComponents.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath, + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + + var results = Query.QueryDatabase(msiPath, new[] { "CheckBox", "Control", "InstallUISequence" }); + Assert.Equal(new[] + { + "CheckBox:WIXUI_EXITDIALOGOPTIONALCHECKBOX\t1", + "Control:FirstDialog\tHeader\tText\t0\t13\t90\t13\t3\tFirstDialogHeader\tTitle\t\t", + "Control:FirstDialog\tTitle\tText\t0\t0\t90\t13\t3\tFirstDialogTitle\tHeader\t\t", + "Control:SecondDialog\tOptionalCheckBox\tCheckBox\t0\t13\t100\t40\t2\t[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]\tTitle\t\t", + "Control:SecondDialog\tTitle\tText\t0\t0\t90\t13\t3\tSecondDialogTitle\tOptionalCheckBox\t\t", + "InstallUISequence:CostFinalize\t\t1000", + "InstallUISequence:CostInitialize\t\t800", + "InstallUISequence:ExecuteAction\t\t1300", + "InstallUISequence:FileCost\t\t900", + "InstallUISequence:FindRelatedProducts\t\t25", + "InstallUISequence:FirstDialog\tInstalled AND PATCH\t1298", + "InstallUISequence:LaunchConditions\t\t100", + "InstallUISequence:MigrateFeatureStates\t\t1200", + "InstallUISequence:SecondDialog\tNOT Installed\t1299", + "InstallUISequence:ValidateProductID\t\t700", + }, results); + } + } + [Fact] public void PopulatesCreateFolderTableForNullKeypathComponents() { @@ -982,6 +1030,40 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact(Skip = "Test demonstrates failure")] + public void PopulatesTextStyleTableWhenSizeIsLocalized() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "TextStyle", "SizeLocalized.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-loc", Path.Combine(folder, "TextStyle", "SizeLocalized.en-us.wxl"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath, + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "TextStyle" }); + Assert.Equal(new[] + { + "TextStyle:CustomFont\tTahoma\t8\t\t", + }, results); + } + } + [Fact] public void PopulatesTypeLibTableWhenLanguageIsZero() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.en-us.wxl deleted file mode 100644 index 77d46861..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.en-us.wxl +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - A newer version of [ProductName] is already installed. - MsiPackage - Tahoma - 8 - - diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.wxs deleted file mode 100644 index 6da3dcbe..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/Package.wxs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/PackageComponents.wxs index 724c46ed..1101d901 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/PackageComponents.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/PackageComponents.wxs @@ -2,17 +2,21 @@ - - + + Installed + Installed + + - NOT Installed diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/data/test.txt deleted file mode 100644 index cd0db0e1..00000000 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/DialogsInInstallUISequence/data/test.txt +++ /dev/null @@ -1 +0,0 @@ -This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.en-us.wxl new file mode 100644 index 00000000..77d46861 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.en-us.wxl @@ -0,0 +1,13 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + Tahoma + 8 + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.wxs new file mode 100644 index 00000000..a591fdd9 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/TextStyle/SizeLocalized.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index dbc9357c..13611770 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -34,9 +34,6 @@ - - - @@ -157,6 +154,8 @@ + + -- cgit v1.2.3-55-g6feb