aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-03-19 11:15:12 -0700
committerRob Mensching <rob@firegiant.com>2021-03-19 11:31:45 -0700
commit1fa3b2f3c3e1380a5ae5ed76cdf028f221473da3 (patch)
tree11c5fbfacd0aba0d97405c8ccac9555126523f6f /src/test
parent84d70d16e4ab2051d881251440fe4729f301b265 (diff)
downloadwix-1fa3b2f3c3e1380a5ae5ed76cdf028f221473da3.tar.gz
wix-1fa3b2f3c3e1380a5ae5ed76cdf028f221473da3.tar.bz2
wix-1fa3b2f3c3e1380a5ae5ed76cdf028f221473da3.zip
Update tests to validate Shortcut Name/ShortName handling
Resolves wixtoolset/issues#4227
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs34
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/ShortcutFixture.cs78
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/ShortcutSameNameShortName.wxs12
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msibin32768 -> 32768 bytes
5 files changed, 91 insertions, 35 deletions
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
@@ -716,40 +716,6 @@ namespace WixToolsetTest.CoreIntegration
716 } 716 }
717 717
718 [Fact] 718 [Fact]
719 public void PopulatesMsiShortcutPropertyTable()
720 {
721 var folder = TestData.Get(@"TestData");
722
723 using (var fs = new DisposableFileSystem())
724 {
725 var baseFolder = fs.GetFolder();
726 var intermediateFolder = Path.Combine(baseFolder, "obj");
727 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
728
729 var result = WixRunner.Execute(new[]
730 {
731 "build",
732 Path.Combine(folder, "Shortcut", "ShortcutProperty.wxs"),
733 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
734 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
735 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
736 "-intermediateFolder", intermediateFolder,
737 "-o", msiPath
738 });
739
740 result.AssertSuccess();
741
742 Assert.True(File.Exists(msiPath));
743 var results = Query.QueryDatabase(msiPath, new[] { "MsiShortcutProperty", "Shortcut" });
744 WixAssert.CompareLineByLine(new[]
745 {
746 "MsiShortcutProperty:scp4GOCIx4Eskci4nBG1MV_vSUOZt4\tTheShortcut\tCustomShortcutKey\tCustomShortcutValue",
747 "Shortcut:TheShortcut\tINSTALLFOLDER\td\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t",
748 }, results);
749 }
750 }
751
752 [Fact]
753 public void PopulatesReserveCostTable() 719 public void PopulatesReserveCostTable()
754 { 720 {
755 var folder = TestData.Get(@"TestData"); 721 var folder = TestData.Get(@"TestData");
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 @@
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
3namespace WixToolsetTest.CoreIntegration
4{
5 using System.IO;
6 using WixBuildTools.TestSupport;
7 using WixToolset.Core.TestPackage;
8 using Xunit;
9
10 public class ShortcutFixture
11 {
12 [Fact]
13 public void CanBuildShortcutNameWithShortname()
14 {
15 var folder = TestData.Get(@"TestData");
16
17 using (var fs = new DisposableFileSystem())
18 {
19 var baseFolder = fs.GetFolder();
20 var intermediateFolder = Path.Combine(baseFolder, "obj");
21 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
22
23 var result = WixRunner.Execute(new[]
24 {
25 "build",
26 Path.Combine(folder, "Shortcut", "ShortcutSameNameShortName.wxs"),
27 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
28 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
29 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
30 "-intermediateFolder", intermediateFolder,
31 "-o", msiPath
32 });
33
34 result.AssertSuccess();
35
36 var results = Query.QueryDatabase(msiPath, new[] { "Shortcut" });
37 WixAssert.CompareLineByLine(new[]
38 {
39 "Shortcut:sctzJpBYlrhdx4Mm9Xh41X0KPWYiX0\tINSTALLFOLDER\tDaName\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t",
40 }, results);
41 }
42 }
43
44 [Fact]
45 public void PopulatesMsiShortcutPropertyTable()
46 {
47 var folder = TestData.Get(@"TestData");
48
49 using (var fs = new DisposableFileSystem())
50 {
51 var baseFolder = fs.GetFolder();
52 var intermediateFolder = Path.Combine(baseFolder, "obj");
53 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
54
55 var result = WixRunner.Execute(new[]
56 {
57 "build",
58 Path.Combine(folder, "Shortcut", "ShortcutProperty.wxs"),
59 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
60 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
61 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
62 "-intermediateFolder", intermediateFolder,
63 "-o", msiPath
64 });
65
66 result.AssertSuccess();
67
68 Assert.True(File.Exists(msiPath));
69 var results = Query.QueryDatabase(msiPath, new[] { "MsiShortcutProperty", "Shortcut" });
70 WixAssert.CompareLineByLine(new[]
71 {
72 "MsiShortcutProperty:scp4GOCIx4Eskci4nBG1MV_vSUOZt4\tTheShortcut\tCustomShortcutKey\tCustomShortcutValue",
73 "Shortcut:TheShortcut\tINSTALLFOLDER\td\tShortcutComp\t[#filcV1yrx0x8wJWj4qMzcH21jwkPko]\t\t\t\t\t\t\t\t\t\t\t",
74 }, results);
75 }
76 }
77 }
78}
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 @@
6 <Component Id="ShortcutComp" Guid="{5B3B3FC1-533D-4C29-BFB3-0E88B51E59D8}" Bitness="always32"> 6 <Component Id="ShortcutComp" Guid="{5B3B3FC1-533D-4C29-BFB3-0E88B51E59D8}" Bitness="always32">
7 <File Id="test.txt" Name="test.txt" KeyPath="yes" Source="SourceDir\\MsiPackage\test.txt" /> 7 <File Id="test.txt" Name="test.txt" KeyPath="yes" Source="SourceDir\\MsiPackage\test.txt" />
8 <Shortcut Id="FileTargetShortcut" Directory="INSTALLFOLDER" Name="FileTargetShortcut" ShortName="lm2tdtqp" Target="[#test.txt]" /> 8 <Shortcut Id="FileTargetShortcut" Directory="INSTALLFOLDER" Name="FileTargetShortcut" ShortName="lm2tdtqp" Target="[#test.txt]" />
9 <Shortcut Id="CustomTargetShortcut" Directory="INSTALLFOLDER" Name="CustomTargetShortcut" ShortName="treusbt_" Target="[INSTALLFOLDER]custom.target" /> 9 <Shortcut Id="CustomTargetShortcut" Directory="INSTALLFOLDER" Name="Planner" ShortName="PLANNER" Target="[INSTALLFOLDER]custom.target" />
10 <Shortcut Id="AdvtShortcut" Directory="INSTALLFOLDER" Name="AdvtShortcut" ShortName="mdbqel9r" Advertise="yes" /> 10 <Shortcut Id="AdvtShortcut" Directory="INSTALLFOLDER" Name="AdvtShortcut" ShortName="mdbqel9r" Advertise="yes" />
11 </Component> 11 </Component>
12 </Directory> 12 </Directory>
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 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents">
5 <Component Id="ShortcutComp" Directory="INSTALLFOLDER" Guid="5B3B3FC1-533D-4C29-BFB3-0E88B51E59D8">
6 <File Source="test.txt">
7 <Shortcut Name="DaName" ShortName="DANAME" Directory="INSTALLFOLDER" />
8 </File>
9 </Component>
10 </ComponentGroup>
11 </Fragment>
12</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi
index 3a24d1a8..8737f3c2 100644
--- a/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi
Binary files differ