Skip to content

Commit

Permalink
Add tests demonstrating linker error.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson committed Mar 8, 2024
1 parent 5baa1df commit 59e9828
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
56 changes: 44 additions & 12 deletions src/ext/UI/test/WixToolsetTest.UI/UIExtensionFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void CanBuildUsingWixUIAdvanced()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:AdvancedWelcomeEulaDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand All @@ -46,6 +46,11 @@ public void CanBuildUsingWixUIAdvanced()
"ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t1",
"ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:AdvancedWelcomeEulaDlg\tNOT Installed\t1296",
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
Expand All @@ -55,7 +60,7 @@ public void CanBuildUsingWixUIAdvancedX64()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:AdvancedWelcomeEulaDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand Down Expand Up @@ -91,7 +96,7 @@ public void CanBuildUsingWixUIAdvancedARM64()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(BuildARM64, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(BuildARM64, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:AdvancedWelcomeEulaDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand Down Expand Up @@ -127,7 +132,7 @@ public void CanBuildUsingWixUIFeatureTree()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(BuildX64, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:WelcomeDlg\t"));
Assert.Single(results, result => result.StartsWith("Dialog:CustomizeDlg\t"));
Assert.Empty(results.Where(result => result.StartsWith("Dialog:SetupTypeDlg\t")));
Expand All @@ -150,17 +155,22 @@ public void CanBuildUsingWixUIFeatureTree()
{
"ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X64\t1\t1",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
public void CanBuildUsingWixUIInstallDirWithCustomizedEula()
public void CanBuildWithWixUIInstallDirWithCustomizedEula()
{
var folder = TestData.Get(@"TestData", "WixUI_InstallDir");
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(BuildEula, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent");
var results = build.BuildAndQuery(BuildEula, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t"));
Assert.Single(results, result => result.StartsWith("Dialog:WelcomeDlg\t"));
WixAssert.CompareLineByLine(new[]
{
"Binary:WixUI_Bmp_Banner\t[Binary data]",
Expand All @@ -186,6 +196,10 @@ public void CanBuildUsingWixUIInstallDirWithCustomizedEula()
"ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t2",
"ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X86\t1\t1",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
Expand All @@ -195,7 +209,7 @@ public void CanBuildUsingWixUIMinimal()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:WelcomeEulaDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand All @@ -215,6 +229,11 @@ public void CanBuildUsingWixUIMinimal()
{
"ControlEvent:WelcomeEulaDlg\tPrint\tDoAction\tWixUIPrintEula_X86\t1\t1",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
"InstallUISequence:WelcomeEulaDlg\tNOT Installed\t1296",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
Expand Down Expand Up @@ -262,7 +281,7 @@ public void CanBuildUsingWixUIMondo()
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent");
var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:WelcomeDlg\t"));
Assert.Single(results, result => result.StartsWith("Dialog:CustomizeDlg\t"));
Assert.Single(results, result => result.StartsWith("Dialog:SetupTypeDlg\t"));
Expand All @@ -286,6 +305,10 @@ public void CanBuildUsingWixUIMondo()
"ControlEvent:BrowseDlg\tOK\tDoAction\tWixUIValidatePath_X86\tNOT WIXUI_DONTVALIDATEPATH\t3",
"ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X86\t1\t1",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
Expand All @@ -303,13 +326,13 @@ public void CanBuildUsingWixUIMondoLocalized()
}

[Fact]
public void CanBuildUsingWithInstallDirAndRemovedDialog()
public void CanBuildWithInstallDirAndRemovedDialog()
{
var folder = TestData.Get(@"TestData", "InstallDir_NoLicense");
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent");
var results = build.BuildAndQuery(Build, "Binary", "Dialog", "CustomAction", "Property", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand All @@ -336,16 +359,21 @@ public void CanBuildUsingWithInstallDirAndRemovedDialog()
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());

Assert.Empty(results.Where(result => result.Contains("LicenseAgreementDlg")).ToArray());

WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
public void CanBuildUsingWithInstallDirAndAddedDialog()
public void CanBuildWithInstallDirAndAddedDialog()
{
var folder = TestData.Get(@"TestData", "InstallDir_SpecialDlg");
var bindFolder = TestData.Get(@"TestData", "data");
var build = new Builder(folder, typeof(UIExtensionFactory), new[] { bindFolder });

var results = build.BuildAndQuery(BuildX64, "Binary", "Control", "Dialog", "CustomAction", "Property", "ControlEvent");
var results = build.BuildAndQuery(BuildX64, "Binary", "Control", "Dialog", "CustomAction", "Property", "ControlEvent", "InstallUISequence");
Assert.Single(results, result => result.StartsWith("Dialog:InstallDirDlg\t"));
WixAssert.CompareLineByLine(new[]
{
Expand All @@ -372,6 +400,10 @@ public void CanBuildUsingWithInstallDirAndAddedDialog()
"ControlEvent:InstallDirDlg\tNext\tDoAction\tWixUIValidatePath_X64\tNOT WIXUI_DONTVALIDATEPATH\t2",
"ControlEvent:LicenseAgreementDlg\tPrint\tDoAction\tWixUIPrintEula_X64\t1\t1",
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).OrderBy(s => s).ToArray());
WixAssert.CompareLineByLine(new[]
{
"InstallUISequence:WelcomeDlg\tInstalled AND PATCH\t1295",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());

Assert.Equal(8, results.Where(result => result.StartsWith("Control:") && result.Contains("SpecialDlg")).Count());
Assert.Equal(5, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("SpecialDlg")).Count());
Expand Down
2 changes: 1 addition & 1 deletion src/ext/UI/ui.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
msbuild -Restore -p:Configuration=%_C% -tl -nologo -warnaserror -bl:%_L%\ext_ui_build.binlog || exit /b

:: Test
:: dotnet test -c %_C% --no-build test\WixToolsetTest.UI || exit /b
dotnet test -c %_C% --no-build test\WixToolsetTest.UI || exit /b

:: Pack
msbuild -t:Pack -p:Configuration=%_C% -tl -nologo -warnaserror -p:NoBuild=true wixext\WixToolset.UI.wixext.csproj || exit /b
Expand Down

0 comments on commit 59e9828

Please sign in to comment.