From 1fa3b2f3c3e1380a5ae5ed76cdf028f221473da3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Fri, 19 Mar 2021 11:15:12 -0700 Subject: Update tests to validate Shortcut Name/ShortName handling Resolves wixtoolset/issues#4227 --- .../MsiQueryFixture.cs | 34 --------- .../ShortcutFixture.cs | 78 +++++++++++++++++++++ .../TestData/Shortcut/DecompiledShortcuts.wxs | 2 +- .../Shortcut/ShortcutSameNameShortName.wxs | 12 ++++ .../TestData/Shortcut/shortcuts.msi | Bin 32768 -> 32768 bytes 5 files changed, 91 insertions(+), 35 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/ShortcutFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/ShortcutSameNameShortName.wxs (limited to 'src/test') diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 2af47034..71edddc6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -715,40 +715,6 @@ namespace WixToolsetTest.CoreIntegration } } - [Fact] - public void PopulatesMsiShortcutPropertyTable() - { - 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, "Shortcut", "ShortcutProperty.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[] { "MsiShortcutProperty", "Shortcut" }); - WixAssert.CompareLineByLine(new[] - { - "MsiShortcutProperty:scp4GOCIx4Eskci4nBG1MV_vSUOZt4\tTheShortcut\tCustomShortcutKey\tCustomShortcutValue", - "Shortcut:TheShortcut\tINSTALLFOLDER\td\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t", - }, results); - } - } - [Fact] public void PopulatesReserveCostTable() { diff --git a/src/test/WixToolsetTest.CoreIntegration/ShortcutFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ShortcutFixture.cs new file mode 100644 index 00000000..3b6c50c0 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ShortcutFixture.cs @@ -0,0 +1,78 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System.IO; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using Xunit; + + public class ShortcutFixture + { + [Fact] + public void CanBuildShortcutNameWithShortname() + { + 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, "Shortcut", "ShortcutSameNameShortName.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(); + + var results = Query.QueryDatabase(msiPath, new[] { "Shortcut" }); + WixAssert.CompareLineByLine(new[] + { + "Shortcut:sctzJpBYlrhdx4Mm9Xh41X0KPWYiX0\tINSTALLFOLDER\tDaName\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t", + }, results); + } + } + + [Fact] + public void PopulatesMsiShortcutPropertyTable() + { + 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, "Shortcut", "ShortcutProperty.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[] { "MsiShortcutProperty", "Shortcut" }); + WixAssert.CompareLineByLine(new[] + { + "MsiShortcutProperty:scp4GOCIx4Eskci4nBG1MV_vSUOZt4\tTheShortcut\tCustomShortcutKey\tCustomShortcutValue", + "Shortcut:TheShortcut\tINSTALLFOLDER\td\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t", + }, results); + } + } + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs index 13412b50..ab57b0cd 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs @@ -6,7 +6,7 @@ - + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/ShortcutSameNameShortName.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/ShortcutSameNameShortName.wxs new file mode 100644 index 00000000..d704bbf1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/ShortcutSameNameShortName.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi index 3a24d1a8..8737f3c2 100644 Binary files a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi and b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi differ -- cgit v1.2.3-55-g6feb