Skip to content

Commit 6aad94d

Browse files
Olina-ZhangCopilot
andauthored
Add unit test for ToolStrip.ToolStripAccessibleObjectWrapperForItemsOnOverflow.cs file (#13793)
* Add unit test for ToolStrip.ToolStripAccessibleObjectWrapperForItemsOnOverflow.cs file * Update src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStrip.ToolStripAccessibleObjectWrapperForItemsOnOverflowTests.cs fix copilot suggestion Co-authored-by: Copilot <[email protected]> * Resolve the error. * handle feedback * handle feedback2 --------- Co-authored-by: Copilot <[email protected]>
1 parent 825fde2 commit 6aad94d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/unit/System.Windows.Forms/System/Windows/Forms/ToolStrip.ToolStripAccessibleObjectWrapperForItemsOnOverflowTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,22 @@ public void ToolStripAccessibleObjectWrapperForItemsOnOverflow_GetPropertyValue_
8686
Assert.Equal(role, actual);
8787
Assert.False(toolStrip.IsHandleCreated);
8888
}
89+
90+
[WinFormsFact]
91+
public void ToolStripAccessibleObjectWrapperForItemsOnOverflow_State_Includes_Offscreen_And_Invisible()
92+
{
93+
using ToolStripButton toolStripItem = new();
94+
95+
Type wrapperType = typeof(ToolStrip)
96+
.GetNestedType("ToolStripAccessibleObjectWrapperForItemsOnOverflow", BindingFlags.Instance | BindingFlags.NonPublic);
97+
98+
wrapperType.Should().NotBeNull("ToolStripAccessibleObjectWrapperForItemsOnOverflow nested type must exist on ToolStrip");
99+
100+
ToolStripItemAccessibleObject accessibleObject =
101+
(ToolStripItemAccessibleObject)Activator.CreateInstance(wrapperType, toolStripItem);
102+
AccessibleStates state = accessibleObject.State;
103+
104+
state.Should().HaveFlag(AccessibleStates.Offscreen);
105+
state.Should().HaveFlag(AccessibleStates.Invisible);
106+
}
89107
}

0 commit comments

Comments
 (0)