Skip to content

Commit

Permalink
Skip CSharpWinForms.DeleteControl on 32 bit release (#76239)
Browse files Browse the repository at this point in the history
  • Loading branch information
arunchndr authored Dec 4, 2024
2 parents d0374bd + 70c8f66 commit 56e066c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/Compilers/Test/Core/Assert/ConditionalFactAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public static class ExecutionConditionUtil
public static bool IsCoreClr => !IsDesktop;
public static bool IsCoreClrUnix => IsCoreClr && IsUnix;
public static bool IsMonoOrCoreClr => IsMonoDesktop || IsCoreClr;
public static bool IsBitness64 => IntPtr.Size == 8;
public static bool RuntimeSupportsCovariantReturnsOfClasses => Type.GetType("System.Runtime.CompilerServices.RuntimeFeature")?.GetField("CovariantReturnsOfClasses") != null;

private static readonly Lazy<bool> s_operatingSystemRestrictsFileNames = new Lazy<bool>(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.CodeAnalysis.Test.Utilities;
using Microsoft.VisualStudio.IntegrationTest.Utilities;
using Roslyn.VisualStudio.IntegrationTests;
using Roslyn.Test.Utilities;
using Xunit;

namespace Roslyn.VisualStudio.NewIntegrationTests.CSharp;
Expand Down Expand Up @@ -204,32 +205,34 @@ await TestServices.Workspace.WaitForAllAsyncOperationsAsync(
var actualText = await TestServices.Editor.GetTextAsync(HangMitigatingCancellationToken);
Assert.Contains(@"public System.Windows.Forms.Button SomeButton;", actualText);
}

[IdeFact]
public async Task DeleteControl()
{
var project = ProjectName;
await TestServices.SolutionExplorer.OpenFileWithDesignerAsync(project, "Form1.cs", HangMitigatingCancellationToken);
await TestServices.Editor.AddWinFormButtonAsync("SomeButton", HangMitigatingCancellationToken);
await TestServices.SolutionExplorer.SaveFileAsync(project, "Form1.cs", HangMitigatingCancellationToken);
await TestServices.SolutionExplorer.SaveFileAsync(project, "Form1.resx", HangMitigatingCancellationToken);
await TestServices.Editor.DeleteWinFormButtonAsync("SomeButton", HangMitigatingCancellationToken);

await TestServices.Workspace.WaitForAllAsyncOperationsAsync(
[
FeatureAttribute.Workspace,
FeatureAttribute.SolutionCrawlerLegacy,
FeatureAttribute.DiagnosticService,
FeatureAttribute.EditAndContinue,
FeatureAttribute.ErrorSquiggles,
FeatureAttribute.ErrorList,
],
HangMitigatingCancellationToken);

Assert.Empty(await TestServices.ErrorList.GetBuildErrorsAsync(HangMitigatingCancellationToken));
await TestServices.SolutionExplorer.OpenFileAsync(project, "Form1.Designer.cs", HangMitigatingCancellationToken);
var actualText = await TestServices.Editor.GetTextAsync(HangMitigatingCancellationToken);
Assert.DoesNotContain(@"VisualStudio.Editor.SomeButton.Name = ""SomeButton"";", actualText);
Assert.DoesNotContain(@"private System.Windows.Forms.Button SomeButton;", actualText);
if (ExecutionConditionUtil.IsBitness64)
{
var project = ProjectName;
await TestServices.SolutionExplorer.OpenFileWithDesignerAsync(project, "Form1.cs", HangMitigatingCancellationToken);
await TestServices.Editor.AddWinFormButtonAsync("SomeButton", HangMitigatingCancellationToken);
await TestServices.SolutionExplorer.SaveFileAsync(project, "Form1.cs", HangMitigatingCancellationToken);
await TestServices.SolutionExplorer.SaveFileAsync(project, "Form1.resx", HangMitigatingCancellationToken);
await TestServices.Editor.DeleteWinFormButtonAsync("SomeButton", HangMitigatingCancellationToken);

await TestServices.Workspace.WaitForAllAsyncOperationsAsync(
[
FeatureAttribute.Workspace,
FeatureAttribute.SolutionCrawlerLegacy,
FeatureAttribute.DiagnosticService,
FeatureAttribute.EditAndContinue,
FeatureAttribute.ErrorSquiggles,
FeatureAttribute.ErrorList,
],
HangMitigatingCancellationToken);

Assert.Empty(await TestServices.ErrorList.GetBuildErrorsAsync(HangMitigatingCancellationToken));
await TestServices.SolutionExplorer.OpenFileAsync(project, "Form1.Designer.cs", HangMitigatingCancellationToken);
var actualText = await TestServices.Editor.GetTextAsync(HangMitigatingCancellationToken);
Assert.DoesNotContain(@"VisualStudio.Editor.SomeButton.Name = ""SomeButton"";", actualText);
Assert.DoesNotContain(@"private System.Windows.Forms.Button SomeButton;", actualText);
}
}
}

0 comments on commit 56e066c

Please sign in to comment.