diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-19 19:08:40 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-07-19 19:22:41 +1000 |
| commit | ecad1128c6223920a035cd12502e316452e61c93 (patch) | |
| tree | 3ae6a1120ec443d3e67dbf38a448e93628cd507e /src | |
| parent | 901e856ef5c72be5fc7cfb3077e2e60892ddd4cc (diff) | |
| download | wix-ecad1128c6223920a035cd12502e316452e61c93.tar.gz wix-ecad1128c6223920a035cd12502e316452e61c93.tar.bz2 wix-ecad1128c6223920a035cd12502e316452e61c93.zip | |
Set DpiAwareness to "unaware" from v3.
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 18 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs | 76 |
2 files changed, 93 insertions, 1 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index 3ea0c3dc..c9ebdfd3 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
| @@ -39,6 +39,7 @@ namespace WixToolset.Converters | |||
| 39 | private static readonly XName AdvertiseExecuteSequenceElementName = WixNamespace + "AdvertiseExecuteSequence"; | 39 | private static readonly XName AdvertiseExecuteSequenceElementName = WixNamespace + "AdvertiseExecuteSequence"; |
| 40 | private static readonly XName InstallExecuteSequenceElementName = WixNamespace + "InstallExecuteSequence"; | 40 | private static readonly XName InstallExecuteSequenceElementName = WixNamespace + "InstallExecuteSequence"; |
| 41 | private static readonly XName InstallUISequenceSequenceElementName = WixNamespace + "InstallUISequence"; | 41 | private static readonly XName InstallUISequenceSequenceElementName = WixNamespace + "InstallUISequence"; |
| 42 | private static readonly XName BootstrapperApplicationElementName = WixNamespace + "BootstrapperApplication"; | ||
| 42 | private static readonly XName EmbeddedChainerElementName = WixNamespace + "EmbeddedChainer"; | 43 | private static readonly XName EmbeddedChainerElementName = WixNamespace + "EmbeddedChainer"; |
| 43 | private static readonly XName ColumnElementName = WixNamespace + "Column"; | 44 | private static readonly XName ColumnElementName = WixNamespace + "Column"; |
| 44 | private static readonly XName ComponentElementName = WixNamespace + "Component"; | 45 | private static readonly XName ComponentElementName = WixNamespace + "Component"; |
| @@ -130,6 +131,7 @@ namespace WixToolset.Converters | |||
| 130 | { WixConverter.AdvertiseExecuteSequenceElementName, this.ConvertSequenceElement }, | 131 | { WixConverter.AdvertiseExecuteSequenceElementName, this.ConvertSequenceElement }, |
| 131 | { WixConverter.InstallUISequenceSequenceElementName, this.ConvertSequenceElement }, | 132 | { WixConverter.InstallUISequenceSequenceElementName, this.ConvertSequenceElement }, |
| 132 | { WixConverter.InstallExecuteSequenceElementName, this.ConvertSequenceElement }, | 133 | { WixConverter.InstallExecuteSequenceElementName, this.ConvertSequenceElement }, |
| 134 | { WixConverter.BootstrapperApplicationElementName, this.ConvertBootstrapperApplicationElement }, | ||
| 133 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, | 135 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, |
| 134 | { WixConverter.CustomTableElementName, this.ConvertCustomTableElement }, | 136 | { WixConverter.CustomTableElementName, this.ConvertCustomTableElement }, |
| 135 | { WixConverter.ControlElementName, this.ConvertControlElement }, | 137 | { WixConverter.ControlElementName, this.ConvertControlElement }, |
| @@ -442,6 +444,15 @@ namespace WixToolset.Converters | |||
| 442 | } | 444 | } |
| 443 | } | 445 | } |
| 444 | 446 | ||
| 447 | private void ConvertBootstrapperApplicationElement(XElement element) | ||
| 448 | { | ||
| 449 | if (this.SourceVersion < 4 && null == element.Attribute("DpiAwareness") && | ||
| 450 | this.OnError(ConverterTestType.AssignBootstrapperApplicationDpiAwareness, element, "The BootstrapperApplication DpiAwareness attribute is being set to 'unaware' to ensure it remains the same as the v3 default")) | ||
| 451 | { | ||
| 452 | element.Add(new XAttribute("DpiAwareness", "unaware")); | ||
| 453 | } | ||
| 454 | } | ||
| 455 | |||
| 445 | private void ConvertColumnElement(XElement element) | 456 | private void ConvertColumnElement(XElement element) |
| 446 | { | 457 | { |
| 447 | var category = element.Attribute("Category"); | 458 | var category = element.Attribute("Category"); |
| @@ -1212,7 +1223,12 @@ namespace WixToolset.Converters | |||
| 1212 | /// <summary> | 1223 | /// <summary> |
| 1213 | /// The Condition='1' attribute is unnecessary on Publish elements. | 1224 | /// The Condition='1' attribute is unnecessary on Publish elements. |
| 1214 | /// </summary> | 1225 | /// </summary> |
| 1215 | PublishConditionOneUnnecessary | 1226 | PublishConditionOneUnnecessary, |
| 1227 | |||
| 1228 | /// <summary> | ||
| 1229 | /// DpiAwareness is new and is defaulted to 'perMonitorV2' which is a change in behavior. | ||
| 1230 | /// </summary> | ||
| 1231 | AssignBootstrapperApplicationDpiAwareness, | ||
| 1216 | } | 1232 | } |
| 1217 | } | 1233 | } |
| 1218 | } | 1234 | } |
diff --git a/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs new file mode 100644 index 00000000..1551077b --- /dev/null +++ b/src/test/WixToolsetTest.Converters/BootstrapperApplicationFixture.cs | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Converters | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Xml.Linq; | ||
| 7 | using WixBuildTools.TestSupport; | ||
| 8 | using WixToolset.Converters; | ||
| 9 | using WixToolsetTest.Converters.Mocks; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class BootstrapperApplicationFixture : BaseConverterFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void SetsDpiUnawareFromV3() | ||
| 16 | { | ||
| 17 | var parse = String.Join(Environment.NewLine, | ||
| 18 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", | ||
| 19 | " <Fragment>", | ||
| 20 | " <BootstrapperApplication Id='ba' />", | ||
| 21 | " </Fragment>", | ||
| 22 | "</Wix>"); | ||
| 23 | |||
| 24 | var expected = new[] | ||
| 25 | { | ||
| 26 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 27 | " <Fragment>", | ||
| 28 | " <BootstrapperApplication Id=\"ba\" DpiAwareness=\"unaware\" />", | ||
| 29 | " </Fragment>", | ||
| 30 | "</Wix>" | ||
| 31 | }; | ||
| 32 | |||
| 33 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 34 | |||
| 35 | var messaging = new MockMessaging(); | ||
| 36 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 37 | |||
| 38 | var errors = converter.ConvertDocument(document); | ||
| 39 | Assert.Equal(2, errors); | ||
| 40 | |||
| 41 | var actualLines = UnformattedDocumentLines(document); | ||
| 42 | CompareLineByLine(expected, actualLines); | ||
| 43 | } | ||
| 44 | |||
| 45 | [Fact] | ||
| 46 | public void DoesntSetDpiUnawareFromV4() | ||
| 47 | { | ||
| 48 | var parse = String.Join(Environment.NewLine, | ||
| 49 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 50 | " <Fragment>", | ||
| 51 | " <BootstrapperApplication Id='ba' />", | ||
| 52 | " </Fragment>", | ||
| 53 | "</Wix>"); | ||
| 54 | |||
| 55 | var expected = new[] | ||
| 56 | { | ||
| 57 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 58 | " <Fragment>", | ||
| 59 | " <BootstrapperApplication Id=\"ba\" />", | ||
| 60 | " </Fragment>", | ||
| 61 | "</Wix>" | ||
| 62 | }; | ||
| 63 | |||
| 64 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 65 | |||
| 66 | var messaging = new MockMessaging(); | ||
| 67 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 68 | |||
| 69 | var errors = converter.ConvertDocument(document); | ||
| 70 | Assert.Equal(0, errors); | ||
| 71 | |||
| 72 | var actualLines = UnformattedDocumentLines(document); | ||
| 73 | CompareLineByLine(expected, actualLines); | ||
| 74 | } | ||
| 75 | } | ||
| 76 | } | ||
