diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-08-31 16:33:53 -0400 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-08-31 16:37:36 -0400 |
| commit | cdef9c078068b7dc23b348b2142dc13dd5a936fb (patch) | |
| tree | 5da93342c8ba470e43d59bb4771eb6acec38caf4 /src | |
| parent | c2d23a0d9c4d7b7205a288b1aa912b7f8d68702d (diff) | |
| download | wix-cdef9c078068b7dc23b348b2142dc13dd5a936fb.tar.gz wix-cdef9c078068b7dc23b348b2142dc13dd5a936fb.tar.bz2 wix-cdef9c078068b7dc23b348b2142dc13dd5a936fb.zip | |
Convert Feature/@Absent=disallow to AllowAbsent=no.
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 8 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Converters/FeatureFixture.cs | 34 |
2 files changed, 37 insertions, 5 deletions
diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index f6918702..f10875f1 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs | |||
| @@ -560,9 +560,9 @@ namespace WixToolset.Converters | |||
| 560 | if (xAbsent != null && | 560 | if (xAbsent != null && |
| 561 | this.OnError(ConverterTestType.FeatureAbsentAttributeReplaced, element, "The Feature element's Absent attribute has been replaced with the AllowAbsent attribute. Use the 'AllowAbsent' attribute instead.")) | 561 | this.OnError(ConverterTestType.FeatureAbsentAttributeReplaced, element, "The Feature element's Absent attribute has been replaced with the AllowAbsent attribute. Use the 'AllowAbsent' attribute instead.")) |
| 562 | { | 562 | { |
| 563 | if (xAbsent.Value == "allow") | 563 | if (xAbsent.Value == "disallow") |
| 564 | { | 564 | { |
| 565 | element.Add(new XAttribute("AllowAbsent", "yes")); | 565 | element.Add(new XAttribute("AllowAbsent", "no")); |
| 566 | } | 566 | } |
| 567 | xAbsent.Remove(); | 567 | xAbsent.Remove(); |
| 568 | } | 568 | } |
| @@ -571,12 +571,12 @@ namespace WixToolset.Converters | |||
| 571 | if (xAllowAdvertise != null) | 571 | if (xAllowAdvertise != null) |
| 572 | { | 572 | { |
| 573 | if ((xAllowAdvertise.Value == "system" || xAllowAdvertise.Value == "allow") && | 573 | if ((xAllowAdvertise.Value == "system" || xAllowAdvertise.Value == "allow") && |
| 574 | this.OnError(ConverterTestType.FeatureAllowAdvertiseValueDeprecated, element, "The AllowAdvertise attribute's '{0}' value deprecated. Set the value to 'yes' instead.", xAllowAdvertise.Value)) | 574 | this.OnError(ConverterTestType.FeatureAllowAdvertiseValueDeprecated, element, "The AllowAdvertise attribute's '{0}' value is deprecated. Set the value to 'yes' instead.", xAllowAdvertise.Value)) |
| 575 | { | 575 | { |
| 576 | xAllowAdvertise.Value = "yes"; | 576 | xAllowAdvertise.Value = "yes"; |
| 577 | } | 577 | } |
| 578 | else if (xAllowAdvertise.Value == "disallow" && | 578 | else if (xAllowAdvertise.Value == "disallow" && |
| 579 | this.OnError(ConverterTestType.FeatureAllowAdvertiseValueDeprecated, element, "The AllowAdvertise attribute's '{0}' value deprecated. Remove the value instead.", xAllowAdvertise.Value)) | 579 | this.OnError(ConverterTestType.FeatureAllowAdvertiseValueDeprecated, element, "The AllowAdvertise attribute's '{0}' value is deprecated. Remove the value instead.", xAllowAdvertise.Value)) |
| 580 | { | 580 | { |
| 581 | xAllowAdvertise.Remove(); | 581 | xAllowAdvertise.Remove(); |
| 582 | } | 582 | } |
diff --git a/src/test/WixToolsetTest.Converters/FeatureFixture.cs b/src/test/WixToolsetTest.Converters/FeatureFixture.cs index 9d943773..8240945d 100644 --- a/src/test/WixToolsetTest.Converters/FeatureFixture.cs +++ b/src/test/WixToolsetTest.Converters/FeatureFixture.cs | |||
| @@ -25,7 +25,7 @@ namespace WixToolsetTest.Converters | |||
| 25 | { | 25 | { |
| 26 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | 26 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
| 27 | " <Fragment>", | 27 | " <Fragment>", |
| 28 | " <Feature AllowAdvertise=\"yes\" AllowAbsent=\"yes\" />", | 28 | " <Feature AllowAdvertise=\"yes\" />", |
| 29 | " </Fragment>", | 29 | " </Fragment>", |
| 30 | "</Wix>" | 30 | "</Wix>" |
| 31 | }; | 31 | }; |
| @@ -43,6 +43,38 @@ namespace WixToolsetTest.Converters | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | [Fact] | 45 | [Fact] |
| 46 | public void FixDisallowAttributes() | ||
| 47 | { | ||
| 48 | var parse = String.Join(Environment.NewLine, | ||
| 49 | "<?xml version=\"1.0\" encoding=\"utf-16\"?>", | ||
| 50 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", | ||
| 51 | " <Fragment>", | ||
| 52 | " <Feature Absent='disallow' AllowAdvertise='no' />", | ||
| 53 | " </Fragment>", | ||
| 54 | "</Wix>"); | ||
| 55 | |||
| 56 | var expected = new[] | ||
| 57 | { | ||
| 58 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 59 | " <Fragment>", | ||
| 60 | " <Feature AllowAdvertise=\"no\" AllowAbsent=\"no\" />", | ||
| 61 | " </Fragment>", | ||
| 62 | "</Wix>" | ||
| 63 | }; | ||
| 64 | |||
| 65 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 66 | |||
| 67 | var messaging = new MockMessaging(); | ||
| 68 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 69 | |||
| 70 | var errors = converter.ConvertDocument(document); | ||
| 71 | Assert.Equal(3, errors); | ||
| 72 | |||
| 73 | var actualLines = UnformattedDocumentLines(document); | ||
| 74 | CompareLineByLine(expected, actualLines); | ||
| 75 | } | ||
| 76 | |||
| 77 | [Fact] | ||
| 46 | public void RemoveDeprecatedAllowAdvertiseAttributes() | 78 | public void RemoveDeprecatedAllowAdvertiseAttributes() |
| 47 | { | 79 | { |
| 48 | var parse = String.Join(Environment.NewLine, | 80 | var parse = String.Join(Environment.NewLine, |
