aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2020-06-03 02:19:16 -0700
committerRob Mensching <rob@firegiant.com>2020-06-03 02:23:16 -0700
commit9317f7c8ea709da55e4602eaaba06952bbf315b7 (patch)
tree51e8348f891041dcc160a6b79e8965ca6a908b9d /src/test
parentd529525a1e331f3ef9ec2707791c99bd78fdd82f (diff)
downloadwix-9317f7c8ea709da55e4602eaaba06952bbf315b7.tar.gz
wix-9317f7c8ea709da55e4602eaaba06952bbf315b7.tar.bz2
wix-9317f7c8ea709da55e4602eaaba06952bbf315b7.zip
Redesign CustomTable tuples to support resolving binary columns
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs115
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTableWithFile.wxs22
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.en-us.wxl7
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/LocalizedCustomTable.wxs21
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file1.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/file2.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj6
9 files changed, 175 insertions, 1 deletions
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
46 var customElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:BundleCustomTable"); 46 var customElements = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:BundleCustomTable");
47 Assert.Equal(3, customElements.Count); 47 Assert.Equal(3, customElements.Count);
48 Assert.Equal("<BundleCustomTable Id='one' Column2='two' />", customElements[0].GetTestXml()); 48 Assert.Equal("<BundleCustomTable Id='one' Column2='two' />", customElements[0].GetTestXml());
49 Assert.Equal("<BundleCustomTable Column2='&lt;' Id='&gt;' />", customElements[1].GetTestXml()); 49 Assert.Equal("<BundleCustomTable Id='&gt;' Column2='&lt;' />", customElements[1].GetTestXml());
50 Assert.Equal("<BundleCustomTable Id='1' Column2='2' />", customElements[2].GetTestXml()); 50 Assert.Equal("<BundleCustomTable Id='1' Column2='2' />", customElements[2].GetTestXml());
51 } 51 }
52 } 52 }
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
@@ -473,6 +473,121 @@ namespace WixToolsetTest.CoreIntegration
473 } 473 }
474 474
475 [Fact] 475 [Fact]
476 public void PopulatesCustomTableWithLocalization()
477 {
478 var folder = TestData.Get(@"TestData");
479
480 using (var fs = new DisposableFileSystem())
481 {
482 var baseFolder = fs.GetFolder();
483 var intermediateFolder = Path.Combine(baseFolder, "obj");
484 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
485
486 var result = WixRunner.Execute(new[]
487 {
488 "build",
489 Path.Combine(folder, "CustomTable", "LocalizedCustomTable.wxs"),
490 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
491 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
492 "-loc", Path.Combine(folder, "CustomTable", "LocalizedCustomTable.en-us.wxl"),
493 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
494 "-intermediateFolder", intermediateFolder,
495 "-o", msiPath
496 });
497
498 result.AssertSuccess();
499
500 Assert.True(File.Exists(msiPath));
501 var results = Query.QueryDatabase(msiPath, new[] { "CustomTableLocalized" });
502 Assert.Equal(new[]
503 {
504 "CustomTableLocalized:Row1\tThis is row one",
505 "CustomTableLocalized:Row2\tThis is row two",
506 }, results);
507 }
508 }
509
510 [Fact]
511 public void PopulatesCustomTableWithFilePath()
512 {
513 var folder = TestData.Get(@"TestData");
514
515 using (var fs = new DisposableFileSystem())
516 {
517 var baseFolder = fs.GetFolder();
518 var intermediateFolder = Path.Combine(baseFolder, "obj");
519 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
520
521 var result = WixRunner.Execute(new[]
522 {
523 "build",
524 Path.Combine(folder, "CustomTable", "CustomTableWithFile.wxs"),
525 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
526 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
527 "-bindpath", Path.Combine(folder, "CustomTable", "data"),
528 "-intermediateFolder", intermediateFolder,
529 "-o", msiPath
530 });
531
532 result.AssertSuccess();
533
534 Assert.True(File.Exists(msiPath));
535 var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" });
536 Assert.Equal(new[]
537 {
538 "CustomTableWithFile:Row1\t[Binary data]",
539 "CustomTableWithFile:Row2\t[Binary data]",
540 }, results);
541 }
542 }
543
544 [Fact]
545 public void PopulatesCustomTableWithFilePathSerialized()
546 {
547 var folder = TestData.Get(@"TestData");
548
549 using (var fs = new DisposableFileSystem())
550 {
551 var baseFolder = fs.GetFolder();
552 var intermediateFolder = Path.Combine(baseFolder, "obj");
553 var wixlibPath = Path.Combine(baseFolder, @"bin\test.wixlib");
554 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
555
556 var result = WixRunner.Execute(new[]
557 {
558 "build",
559 Path.Combine(folder, "CustomTable", "CustomTableWithFile.wxs"),
560 "-bindpath", Path.Combine(folder, "CustomTable", "data"),
561 "-intermediateFolder", intermediateFolder,
562 "-o", wixlibPath
563 });
564
565 result.AssertSuccess();
566
567 result = WixRunner.Execute(new[]
568 {
569 "build",
570 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
571 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
572 "-lib", wixlibPath,
573 "-bindpath", Path.Combine(folder, "CustomTable", "data"),
574 "-intermediateFolder", intermediateFolder,
575 "-o", msiPath
576 });
577
578 result.AssertSuccess();
579
580 Assert.True(File.Exists(msiPath));
581 var results = Query.QueryDatabase(msiPath, new[] { "CustomTableWithFile" });
582 Assert.Equal(new[]
583 {
584 "CustomTableWithFile:Row1\t[Binary data]",
585 "CustomTableWithFile:Row2\t[Binary data]",
586 }, results);
587 }
588 }
589
590 [Fact]
476 public void UnrealCustomTableIsNotPresentInMsi() 591 public void UnrealCustomTableIsNotPresentInMsi()
477 { 592 {
478 var folder = TestData.Get(@"TestData"); 593 var folder = TestData.Get(@"TestData");
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 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents">
5 <ComponentGroupRef Id="MinimalComponentGroup" />
6 </ComponentGroup>
7
8 <CustomTable Id="CustomTableWithFile">
9 <Column Id="Column1" Type="string" PrimaryKey="yes" />
10 <Column Id="Source" Type="binary" Width="0" />
11 <Row>
12 <Data Column="Column1">Row1</Data>
13 <Data Column="Source">file1.txt</Data>
14 </Row>
15 <Row>
16 <Data Column="Source">SourceDir\file2.txt</Data>
17 <Data Column="Column1">Row2</Data>
18 </Row>
19 </CustomTable>
20
21 </Fragment>
22</Wix>
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 @@
1<?xml version="1.0" encoding="utf-8"?>
2<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
3
4 <String Id="Loc1">This is row one</String>
5 <String Id="Loc2">This is row two</String>
6
7</WixLocalization>
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 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents">
5 <ComponentGroupRef Id="MinimalComponentGroup" />
6 </ComponentGroup>
7
8 <CustomTable Id="CustomTableLocalized">
9 <Column Id="Column1" Type="string" PrimaryKey="yes" />
10 <Column Id="DataColumn" Type="string" Localizable="yes" Width="255" />
11 <Row>
12 <Data Column="Column1" Value="Row1" />
13 <Data Column="DataColumn" Value="!(loc.Loc1)" />
14 </Row>
15 <Row>
16 <Data Column="Column1" Value="Row2" />
17 <Data Column="DataColumn" Value="!(loc.Loc2)" />
18 </Row>
19 </CustomTable>
20 </Fragment>
21</Wix>
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 @@
34 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" /> 34 <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" />
35 <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" /> 35 <Content Include="TestData\Class\OldClassTableDef.msi" CopyToOutputDirectory="PreserveNewest" />
36 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" /> 36 <Content Include="TestData\CustomAction\UnscheduledCustomAction.wxs" CopyToOutputDirectory="PreserveNewest" />
37 <Content Include="TestData\CustomTable\CustomTableWithFile.wxs" CopyToOutputDirectory="PreserveNewest" />
38 <Content Include="TestData\CustomTable\data\file1.txt" CopyToOutputDirectory="PreserveNewest" />
39 <Content Include="TestData\CustomTable\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
40 <Content Include="TestData\CustomTable\data\file2.txt" CopyToOutputDirectory="PreserveNewest" />
41 <Content Include="TestData\CustomTable\LocalizedCustomTable.wxs" CopyToOutputDirectory="PreserveNewest" />
37 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" /> 42 <Content Include="TestData\CustomTable\CustomTable.wxs" CopyToOutputDirectory="PreserveNewest" />
43 <Content Include="TestData\CustomTable\LocalizedCustomTable.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
38 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" /> 44 <Content Include="TestData\DefaultDir\DefaultDir.wxs" CopyToOutputDirectory="PreserveNewest" />
39 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 45 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
40 <Content Include="TestData\EnsureTable\EnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" /> 46 <Content Include="TestData\EnsureTable\EnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" />