Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests demonstrating linker error. #503

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 49 additions & 17 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 @@ -120,14 +125,14 @@ public void CanBuildUsingWixUIAdvancedARM64()
}, results.Where(result => result.StartsWith("ControlEvent:") && result.Contains("DoAction")).ToArray());
}

[Fact]
[Fact(Skip = "Linker problem")]
public void CanBuildUsingWixUIFeatureTree()
{
var folder = TestData.Get(@"TestData", "WixUI_FeatureTree");
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\tNOT Installed OR PATCH\t1297",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
public void CanBuildUsingWixUIInstallDirWithCustomizedEula()
[Fact(Skip = "Linker problem")]
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\tNOT Installed OR PATCH\t1297",
}, 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 @@ -255,14 +274,14 @@ public void CanBuildUsingWixUIMinimalAndReadPdb()
}
}

[Fact]
[Fact(Skip = "Linker problem")]
public void CanBuildUsingWixUIMondo()
{
var folder = TestData.Get(@"TestData", "WixUI_Mondo");
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 @@ -302,14 +325,14 @@ public void CanBuildUsingWixUIMondoLocalized()
}, results.Where(s => s.StartsWith("Control:ErrorDlg\tY")).Select(s => s.Split('\t')[9]).ToArray());
}

[Fact]
public void CanBuildUsingWithInstallDirAndRemovedDialog()
[Fact(Skip = "Linker problem")]
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\tNOT Installed OR PATCH\t1297",
}, results.Where(r => r.StartsWith("InstallUISequence:AdvancedWelcome") || r.StartsWith("InstallUISequence:Welcome")).ToArray());
}

[Fact]
public void CanBuildUsingWithInstallDirAndAddedDialog()
[Fact(Skip = "Linker problem")]
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\tNOT Installed OR PATCH\t1297",
}, 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
barnson marked this conversation as resolved.
Show resolved Hide resolved

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