From 9317f7c8ea709da55e4602eaaba06952bbf315b7 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 3 Jun 2020 02:19:16 -0700 Subject: Redesign CustomTable tuples to support resolving binary columns --- .../BundleManifestFixture.cs | 2 +- .../MsiQueryFixture.cs | 115 +++++++++++++++++++++ .../TestData/CustomTable/CustomTableWithFile.wxs | 22 ++++ .../CustomTable/LocalizedCustomTable.en-us.wxl | 7 ++ .../TestData/CustomTable/LocalizedCustomTable.wxs | 21 ++++ .../TestData/CustomTable/data/file1.txt | 1 + .../TestData/CustomTable/data/file2.txt | 1 + .../TestData/CustomTable/data/test.txt | 1 + .../WixToolsetTest.CoreIntegration.csproj | 6 ++ 9 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTableWithFile.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.en-us.wxl create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file1.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file2.txt create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/test.txt (limited to 'src/test') diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs index 53036919..80c00ef1 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs @@ -46,7 +46,7 @@ namespace WixToolsetTest.CoreIntegration var customElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:BundleCustomTable"); Assert.Equal(3, customElements.Count); Assert.Equal("", customElements[0].GetTestXml()); - Assert.Equal("", customElements[1].GetTestXml()); + Assert.Equal("", customElements[1].GetTestXml()); Assert.Equal("", customElements[2].GetTestXml()); } } diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index aa8a0a0d..78a8f0a4 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -472,6 +472,121 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void PopulatesCustomTableWithLocalization() + { + 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, "CustomTable", "LocalizedCustomTable.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-loc", Path.Combine(folder, "CustomTable", "LocalizedCustomTable.en-us.wxl"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "CustomTableLocalized" }); + Assert.Equal(new[] + { + "CustomTableLocalized:Row1\tThis is row one", + "CustomTableLocalized:Row2\tThis is row two", + }, results); + } + } + + [Fact] + public void PopulatesCustomTableWithFilePath() + { + 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, "CustomTable", "CustomTableWithFile.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "CustomTable", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" }); + Assert.Equal(new[] + { + "CustomTableWithFile:Row1\t[Binary data]", + "CustomTableWithFile:Row2\t[Binary data]", + }, results); + } + } + + [Fact] + public void PopulatesCustomTableWithFilePathSerialized() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var wixlibPath = Path.Combine(baseFolder, @"bin\test.wixlib"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "CustomTable", "CustomTableWithFile.wxs"), + "-bindpath", Path.Combine(folder, "CustomTable", "data"), + "-intermediateFolder", intermediateFolder, + "-o", wixlibPath + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-lib", wixlibPath, + "-bindpath", Path.Combine(folder, "CustomTable", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" }); + Assert.Equal(new[] + { + "CustomTableWithFile:Row1\t[Binary data]", + "CustomTableWithFile:Row2\t[Binary data]", + }, results); + } + } + [Fact] public void UnrealCustomTableIsNotPresentInMsi() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTableWithFile.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTableWithFile.wxs new file mode 100644 index 00000000..ad5ed233 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTableWithFile.wxs @@ -0,0 +1,22 @@ + + + + + + + + + + + + Row1 + file1.txt + + + SourceDir\file2.txt + Row2 + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.en-us.wxl new file mode 100644 index 00000000..bc2ccf04 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.en-us.wxl @@ -0,0 +1,7 @@ + + + + This is row one + This is row two + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.wxs new file mode 100644 index 00000000..e1da74f8 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file1.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file1.txt new file mode 100644 index 00000000..97f701ce --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file1.txt @@ -0,0 +1 @@ +This is file1.txt \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file2.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file2.txt new file mode 100644 index 00000000..46493186 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file2.txt @@ -0,0 +1 @@ +This is file2.txt \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index f9f1ba44..51775cd0 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -34,7 +34,13 @@ + + + + + + -- cgit v1.2.3-55-g6feb