diff options
author | Rob Mensching <rob@firegiant.com> | 2020-06-15 16:07:45 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-06-16 12:15:13 -0700 |
commit | 678c92c50c6fb7aa9a093f0d74d4f92742abd5e8 (patch) | |
tree | ef4d007b74e56734a5258e2235988fbc0ef6996f /src/test | |
parent | 3fb3475b278803576badecfbe8015760de2e7414 (diff) | |
download | wix-678c92c50c6fb7aa9a093f0d74d4f92742abd5e8.tar.gz wix-678c92c50c6fb7aa9a093f0d74d4f92742abd5e8.tar.bz2 wix-678c92c50c6fb7aa9a093f0d74d4f92742abd5e8.zip |
Reorganize media assignment to correctly place facade order optimization
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/CabFixture.cs | 71 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs | 4 |
2 files changed, 73 insertions, 2 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/CabFixture.cs b/src/test/WixToolsetTest.CoreIntegration/CabFixture.cs new file mode 100644 index 00000000..79471554 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/CabFixture.cs | |||
@@ -0,0 +1,71 @@ | |||
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 | |||
3 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Linq; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | using Xunit; | ||
11 | |||
12 | public class CabFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void CabinetFilesSequencedCorrectly() | ||
16 | { | ||
17 | var folder = TestData.Get(@"TestData\MultiFileCompressed"); | ||
18 | |||
19 | using (var fs = new DisposableFileSystem()) | ||
20 | { | ||
21 | var baseFolder = fs.GetFolder(); | ||
22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
23 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
24 | var cabPath = Path.Combine(baseFolder, @"bin\cab1.cab"); | ||
25 | |||
26 | var result = WixRunner.Execute(new[] | ||
27 | { | ||
28 | "build", | ||
29 | Path.Combine(folder, "Package.wxs"), | ||
30 | Path.Combine(folder, "PackageComponents.wxs"), | ||
31 | "-d", "MediaTemplateCompressionLevel", | ||
32 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
33 | "-bindpath", Path.Combine(folder, "data"), | ||
34 | "-intermediateFolder", intermediateFolder, | ||
35 | "-o", msiPath | ||
36 | }); | ||
37 | |||
38 | result.AssertSuccess(); | ||
39 | Assert.True(File.Exists(cabPath)); | ||
40 | |||
41 | var fileTable = Query.QueryDatabase(msiPath, new[] { "File" }); | ||
42 | var fileRows = fileTable.Select(r => new FileRow(r)).OrderBy(f => f.Sequence).ToList(); | ||
43 | |||
44 | Assert.Equal(new[] { 1, 2 }, fileRows.Select(f => f.Sequence).ToArray()); | ||
45 | Assert.Equal(new[] { "test.txt", "Notepad.exe" }, fileRows.Select(f => f.Name).ToArray()); | ||
46 | |||
47 | var files = Query.GetCabinetFiles(cabPath); | ||
48 | Assert.Equal(fileRows.Select(f => f.Id).ToArray(), files.Select(f => f.Name).ToArray()); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | private class FileRow | ||
53 | { | ||
54 | public FileRow(string row) | ||
55 | { | ||
56 | row = row.Substring("File:".Length); | ||
57 | |||
58 | var split = row.Split('\t'); | ||
59 | this.Id = split[0]; | ||
60 | this.Name = split[2]; | ||
61 | this.Sequence = Convert.ToInt32(split[7]); | ||
62 | } | ||
63 | |||
64 | public string Id { get; set; } | ||
65 | |||
66 | public string Name { get; set; } | ||
67 | |||
68 | public int Sequence { get; set; } | ||
69 | } | ||
70 | } | ||
71 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs index d65a07df..82797ebe 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/MultiFileCompressed/PackageComponents.wxs | |||
@@ -3,10 +3,10 @@ | |||
3 | <Fragment> | 3 | <Fragment> |
4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | 4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> |
5 | <Component> | 5 | <Component> |
6 | <File Source="test.txt" /> | 6 | <File Source="$(env.WINDIR)\Notepad.exe" /> |
7 | </Component> | 7 | </Component> |
8 | <Component> | 8 | <Component> |
9 | <File Source="$(env.WINDIR)\Notepad.exe" /> | 9 | <File Source="test.txt" /> |
10 | </Component> | 10 | </Component> |
11 | </ComponentGroup> | 11 | </ComponentGroup> |
12 | </Fragment> | 12 | </Fragment> |