aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-02 14:41:49 -0700
committerRob Mensching <rob@firegiant.com>2021-04-02 14:58:00 -0700
commit4449fcc5b8d104817c67135229682c66c3d892ca (patch)
tree327f617de2e296ddb4e62c50bf07ec8b5dcf0a3e /src/test
parent9cca339473d77c7036035f949239f5231c325968 (diff)
downloadwix-4449fcc5b8d104817c67135229682c66c3d892ca.tar.gz
wix-4449fcc5b8d104817c67135229682c66c3d892ca.tar.bz2
wix-4449fcc5b8d104817c67135229682c66c3d892ca.zip
Enable codepages and languages to be set via .wxl files
Fixes wixtoolset/issues#5801
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/LanguageFixture.cs155
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs4
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.en-us.wxl7
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.ja-jp.wxl7
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxl7
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxs16
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/PackageWithEnSummaryInfo.ja-jp.wxl7
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Language/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs2
10 files changed, 204 insertions, 4 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/LanguageFixture.cs b/src/test/WixToolsetTest.CoreIntegration/LanguageFixture.cs
new file mode 100644
index 00000000..319b0788
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/LanguageFixture.cs
@@ -0,0 +1,155 @@
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 System.Linq;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Core.TestPackage;
9 using WixToolset.Data;
10 using WixToolset.Data.Symbols;
11 using Xunit;
12
13 public class LanguageFixture
14 {
15 [Fact]
16 public void CanBuildWithDefaultProductLanguage()
17 {
18 var folder = TestData.Get(@"TestData", "Language");
19
20 using (var fs = new DisposableFileSystem())
21 {
22 var baseFolder = fs.GetFolder();
23
24 var result = WixRunner.Execute(new[]
25 {
26 "build",
27 Path.Combine(folder, "Package.wxs"),
28 "-loc", Path.Combine(folder, "Package.wxl"),
29 "-bindpath", Path.Combine(folder, "data"),
30 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
31 "-o", Path.Combine(baseFolder, @"bin\test.msi")
32 });
33
34 result.AssertSuccess();
35
36 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
37 var section = intermediate.Sections.Single();
38
39 var propertySymbol = section.Symbols.OfType<PropertySymbol>().Single(p => p.Id.Id == "ProductLanguage");
40 Assert.Equal("0", propertySymbol.Value);
41
42 var summaryPlatform = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage);
43 Assert.Equal("Intel;0", summaryPlatform.Value);
44
45 var summaryCodepage = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.Codepage);
46 Assert.Equal("1252", summaryCodepage.Value);
47 }
48 }
49
50 [Fact]
51 public void CanBuildEnuWxl()
52 {
53 var folder = TestData.Get(@"TestData", "Language");
54
55 using (var fs = new DisposableFileSystem())
56 {
57 var baseFolder = fs.GetFolder();
58
59 var result = WixRunner.Execute(new[]
60 {
61 "build",
62 Path.Combine(folder, "Package.wxs"),
63 "-loc", Path.Combine(folder, "Package.en-us.wxl"),
64 "-bindpath", Path.Combine(folder, "data"),
65 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
66 "-o", Path.Combine(baseFolder, @"bin\test.msi")
67 });
68
69 result.AssertSuccess();
70
71 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
72 var section = intermediate.Sections.Single();
73
74 var propertySymbol = section.Symbols.OfType<PropertySymbol>().Single(p => p.Id.Id == "ProductLanguage");
75 Assert.Equal("1033", propertySymbol.Value);
76
77 var summaryPlatform = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage);
78 Assert.Equal("Intel;1033", summaryPlatform.Value);
79
80 var summaryCodepage = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.Codepage);
81 Assert.Equal("1252", summaryCodepage.Value);
82 }
83 }
84
85 [Fact]
86 public void CanBuildJpnWxl()
87 {
88 var folder = TestData.Get(@"TestData", "Language");
89
90 using (var fs = new DisposableFileSystem())
91 {
92 var baseFolder = fs.GetFolder();
93
94 var result = WixRunner.Execute(new[]
95 {
96 "build",
97 Path.Combine(folder, "Package.wxs"),
98 "-loc", Path.Combine(folder, "Package.ja-jp.wxl"),
99 "-bindpath", Path.Combine(folder, "data"),
100 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
101 "-o", Path.Combine(baseFolder, @"bin\test.msi")
102 });
103
104 result.AssertSuccess();
105
106 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
107 var section = intermediate.Sections.Single();
108
109 var propertySymbol = section.Symbols.OfType<PropertySymbol>().Single(p => p.Id.Id == "ProductLanguage");
110 Assert.Equal("1041", propertySymbol.Value);
111
112 var summaryPlatform = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage);
113 Assert.Equal("Intel;1041", summaryPlatform.Value);
114
115 var summaryCodepage = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.Codepage);
116 Assert.Equal("932", summaryCodepage.Value);
117 }
118 }
119
120 [Fact]
121 public void CanBuildJpnWxlWithEnuSummaryInfo()
122 {
123 var folder = TestData.Get(@"TestData", "Language");
124
125 using (var fs = new DisposableFileSystem())
126 {
127 var baseFolder = fs.GetFolder();
128
129 var result = WixRunner.Execute(new[]
130 {
131 "build",
132 Path.Combine(folder, "Package.wxs"),
133 "-loc", Path.Combine(folder, "PackageWithEnSummaryInfo.ja-jp.wxl"),
134 "-bindpath", Path.Combine(folder, "data"),
135 "-intermediateFolder", Path.Combine(baseFolder, "obj"),
136 "-o", Path.Combine(baseFolder, @"bin\test.msi")
137 });
138
139 result.AssertSuccess();
140
141 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb"));
142 var section = intermediate.Sections.Single();
143
144 var propertySymbol = section.Symbols.OfType<PropertySymbol>().Single(p => p.Id.Id == "ProductLanguage");
145 Assert.Equal("1041", propertySymbol.Value);
146
147 var summaryPlatform = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage);
148 Assert.Equal("Intel;1041", summaryPlatform.Value);
149
150 var summaryCodepage = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.Codepage);
151 Assert.Equal("1252", summaryCodepage.Value);
152 }
153 }
154 }
155}
diff --git a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs
index 41c1d773..f73a57d0 100644
--- a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs
@@ -19,8 +19,8 @@ namespace WixToolsetTest.CoreIntegration
19 [Fact] 19 [Fact]
20 public void MustCompileBeforeLinking() 20 public void MustCompileBeforeLinking()
21 { 21 {
22 var intermediate1 = new Intermediate("TestIntermediate1", new[] { new IntermediateSection("test1", SectionType.Product, 65001) }, null); 22 var intermediate1 = new Intermediate("TestIntermediate1", new[] { new IntermediateSection("test1", SectionType.Product) }, null);
23 var intermediate2 = new Intermediate("TestIntermediate2", new[] { new IntermediateSection("test2", SectionType.Fragment, 65001) }, null); 23 var intermediate2 = new Intermediate("TestIntermediate2", new[] { new IntermediateSection("test2", SectionType.Fragment) }, null);
24 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); 24 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
25 25
26 var listener = new TestMessageListener(); 26 var listener = new TestMessageListener();
diff --git a/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs
index 2d98a66c..cdba85de 100644
--- a/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/ParseFixture.cs
@@ -16,7 +16,7 @@ namespace WixToolsetTest.CoreIntegration
16 public void GeneratesCorrectCustomActionIdentifiers() 16 public void GeneratesCorrectCustomActionIdentifiers()
17 { 17 {
18 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); 18 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
19 var section = new IntermediateSection("section", SectionType.Fragment, 0); 19 var section = new IntermediateSection("section", SectionType.Fragment);
20 var parseHelper = serviceProvider.GetService<IParseHelper>(); 20 var parseHelper = serviceProvider.GetService<IParseHelper>();
21 21
22 parseHelper.CreateCustomActionReference(null, section, "CustomAction32", Platform.X86, CustomActionPlatforms.X86); 22 parseHelper.CreateCustomActionReference(null, section, "CustomAction32", Platform.X86, CustomActionPlatforms.X86);
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.en-us.wxl
new file mode 100644
index 00000000..f7453566
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.en-us.wxl
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>
2<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
3
4 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
5 <String Id="FeatureTitle">MsiPackage</String>
6
7</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.ja-jp.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.ja-jp.wxl
new file mode 100644
index 00000000..ef287da7
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.ja-jp.wxl
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>
2<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="ja-JP">
3
4 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
5 <String Id="FeatureTitle">MsiPackage</String>
6
7</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxl
new file mode 100644
index 00000000..10ebf2c5
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxl
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>
2<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl">
3
4 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
5 <String Id="FeatureTitle">MsiPackage</String>
6
7</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxs
new file mode 100644
index 00000000..2bbc14f9
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/Package.wxs
@@ -0,0 +1,16 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Name="~DefaultLanguagePackage" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3
4 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
5
6 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
7 <Component Directory="INSTALLFOLDER">
8 <File Source="test.txt" />
9 </Component>
10 </Feature>
11 </Package>
12
13 <Fragment>
14 <Directory Id="INSTALLFOLDER" Name="ProgramFilesFolder:\MsiPackage" />
15 </Fragment>
16</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/PackageWithEnSummaryInfo.ja-jp.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/PackageWithEnSummaryInfo.ja-jp.wxl
new file mode 100644
index 00000000..596ee077
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/PackageWithEnSummaryInfo.ja-jp.wxl
@@ -0,0 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?>
2<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" SummaryInformationCodepage="1252" Culture="ja-JP">
3
4 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
5 <String Id="FeatureTitle">MsiPackage</String>
6
7</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Language/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/data/test.txt
new file mode 100644
index 00000000..cd0db0e1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Language/data/test.txt
@@ -0,0 +1 @@
This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs
index 28c68e99..15e5d334 100644
--- a/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs
@@ -25,7 +25,7 @@ namespace WixToolsetTest.CoreIntegration
25 { "ProductNameEditionVersion", new BindVariable() { Id = "ProductNameEditionVersion", Value = "!(loc.ProductNameEdition) v1.2.3" } }, 25 { "ProductNameEditionVersion", new BindVariable() { Id = "ProductNameEditionVersion", Value = "!(loc.ProductNameEdition) v1.2.3" } },
26 }; 26 };
27 27
28 var localization = new Localization(0, "x-none", variables, new Dictionary<string,LocalizedControl>()); 28 var localization = new Localization(0, null, "x-none", variables, new Dictionary<string,LocalizedControl>());
29 29
30 variableResolver.AddLocalization(localization); 30 variableResolver.AddLocalization(localization);
31 31