@@ -1005,6 +1005,174 @@ public void VerifyDynamicSecondaryCommandLabel()
1005
1005
}
1006
1006
}
1007
1007
1008
+ [ TestMethod ]
1009
+ public void VerifyDynamicSecondaryCommandVisibility ( )
1010
+ {
1011
+ if ( PlatformConfiguration . IsOSVersionLessThan ( OSVersion . Redstone2 ) )
1012
+ {
1013
+ Log . Warning ( "Test is disabled pre-RS2 because CommandBarFlyout is not supported pre-RS2" ) ;
1014
+ return ;
1015
+ }
1016
+
1017
+ using ( var setup = new CommandBarFlyoutTestSetupHelper ( ) )
1018
+ {
1019
+ Log . Comment ( "Retrieving FlyoutTarget6" ) ;
1020
+ Button showCommandBarFlyoutButton = FindElement . ByName < Button > ( "Show CommandBarFlyout with no primary commands" ) ;
1021
+
1022
+ Log . Comment ( "Retrieving IsFlyoutOpenCheckBox" ) ;
1023
+ ToggleButton isFlyoutOpenCheckBox = FindElement . ById < ToggleButton > ( "IsFlyoutOpenCheckBox" ) ;
1024
+
1025
+ Log . Comment ( "Retrieving UseSecondaryCommandDynamicVisibilityCheckBox" ) ;
1026
+ ToggleButton useSecondaryCommandDynamicVisibilityCheckBox = FindElement . ById < ToggleButton > ( "UseSecondaryCommandDynamicVisibilityCheckBox" ) ;
1027
+
1028
+ Log . Comment ( "SecondaryCommandDynamicVisibilityChangedCheckBox" ) ;
1029
+ ToggleButton secondaryCommandDynamicVisibilityChangedCheckBox = FindElement . ById < ToggleButton > ( "SecondaryCommandDynamicVisibilityChangedCheckBox" ) ;
1030
+
1031
+ Log . Comment ( "Retrieving DynamicVisibilityTimerIntervalTextBox" ) ;
1032
+ Edit dynamicVisibilityTimerIntervalTextBox = new Edit ( FindElement . ById ( "DynamicVisibilityTimerIntervalTextBox" ) ) ;
1033
+
1034
+ Log . Comment ( "Retrieving DynamicVisibilityChangeCountTextBox" ) ;
1035
+ Edit dynamicVisibilityChangeCountTextBox = new Edit ( FindElement . ById ( "DynamicVisibilityChangeCountTextBox" ) ) ;
1036
+
1037
+ Verify . AreEqual ( ToggleState . Off , isFlyoutOpenCheckBox . ToggleState ) ;
1038
+
1039
+ Log . Comment ( "Change the fifth command bar element's Visibility property asynchronously after the command bar is opened" ) ;
1040
+ useSecondaryCommandDynamicVisibilityCheckBox . Check ( ) ;
1041
+
1042
+ Log . Comment ( "Setting DynamicVisibilityTimerIntervalTextBox to 1s" ) ;
1043
+ dynamicVisibilityTimerIntervalTextBox . SetValue ( "1000" ) ;
1044
+
1045
+ Log . Comment ( "Setting DynamicVisibilityChangeCountTextBox to 1 single change" ) ;
1046
+ dynamicVisibilityChangeCountTextBox . SetValue ( "1" ) ;
1047
+ Wait . ForIdle ( ) ;
1048
+
1049
+ Verify . AreEqual ( ToggleState . Off , secondaryCommandDynamicVisibilityChangedCheckBox . ToggleState ) ;
1050
+
1051
+ Log . Comment ( "Invoking button 'Show CommandBarFlyout with no primary commands' to show the Flyout6 command bar." ) ;
1052
+ showCommandBarFlyoutButton . Invoke ( ) ;
1053
+ Wait . ForIdle ( ) ;
1054
+ Verify . AreEqual ( ToggleState . On , isFlyoutOpenCheckBox . ToggleState ) ;
1055
+
1056
+ FocusHelper . SetFocus ( FindElement . ById ( "UndoButton6" ) ) ;
1057
+
1058
+ Button undoButton6 = FindElement . ById < Button > ( "UndoButton6" ) ;
1059
+ Verify . IsNotNull ( undoButton6 ) ;
1060
+
1061
+ UIObject commandBarElementsContainer = undoButton6 . Parent ;
1062
+ Verify . IsNotNull ( commandBarElementsContainer ) ;
1063
+
1064
+ Rectangle initialBoundingRectangle = commandBarElementsContainer . BoundingRectangle ;
1065
+
1066
+ Log . Comment ( "Initial commandBarElementsContainer.BoundingRectangle.Width=" + initialBoundingRectangle . Width ) ;
1067
+ Log . Comment ( "Initial commandBarElementsContainer.BoundingRectangle.Height=" + initialBoundingRectangle . Height ) ;
1068
+
1069
+ Verify . AreEqual ( ToggleState . Off , secondaryCommandDynamicVisibilityChangedCheckBox . ToggleState ) ;
1070
+
1071
+ Log . Comment ( "Waiting for SecondaryCommandDynamicVisibilityChangedCheckBox becoming checked indicating the asynchronous Visibility property change occurred" ) ;
1072
+ secondaryCommandDynamicVisibilityChangedCheckBox . GetToggledWaiter ( ) . Wait ( ) ;
1073
+ Wait . ForIdle ( ) ;
1074
+
1075
+ Rectangle finalBoundingRectangle = commandBarElementsContainer . BoundingRectangle ;
1076
+
1077
+ Log . Comment ( "Final commandBarElementsContainer.BoundingRectangle.Width=" + finalBoundingRectangle . Width ) ;
1078
+ Log . Comment ( "Final commandBarElementsContainer.BoundingRectangle.Height=" + finalBoundingRectangle . Height ) ;
1079
+
1080
+ Log . Comment ( "Hitting Escape key to close the command bar." ) ;
1081
+ KeyboardHelper . PressKey ( Key . Escape ) ;
1082
+ Wait . ForIdle ( ) ;
1083
+
1084
+ Verify . AreEqual ( ToggleState . Off , isFlyoutOpenCheckBox . ToggleState ) ;
1085
+
1086
+ Log . Comment ( "Verifying the command bar flyout width and height were increased to accommodate the new AppBarButton." ) ;
1087
+ Verify . IsGreaterThan ( finalBoundingRectangle . Width , initialBoundingRectangle . Width ) ;
1088
+ Verify . IsGreaterThan ( finalBoundingRectangle . Height , initialBoundingRectangle . Height ) ;
1089
+ }
1090
+ }
1091
+
1092
+ [ TestMethod ]
1093
+ public void VerifyDynamicOverflowContentRootWidth ( )
1094
+ {
1095
+ if ( PlatformConfiguration . IsOSVersionLessThan ( OSVersion . Redstone2 ) )
1096
+ {
1097
+ Log . Warning ( "Test is disabled pre-RS2 because CommandBarFlyout is not supported pre-RS2" ) ;
1098
+ return ;
1099
+ }
1100
+
1101
+ using ( var setup = new CommandBarFlyoutTestSetupHelper ( ) )
1102
+ {
1103
+ Log . Comment ( "Retrieving FlyoutTarget6" ) ;
1104
+ Button showCommandBarFlyoutButton = FindElement . ByName < Button > ( "Show CommandBarFlyout with no primary commands" ) ;
1105
+
1106
+ Log . Comment ( "Retrieving IsFlyoutOpenCheckBox" ) ;
1107
+ ToggleButton isFlyoutOpenCheckBox = FindElement . ById < ToggleButton > ( "IsFlyoutOpenCheckBox" ) ;
1108
+
1109
+ Log . Comment ( "Retrieving UseOverflowContentRootDynamicWidthCheckBox" ) ;
1110
+ ToggleButton useOverflowContentRootDynamicWidthCheckBox = FindElement . ById < ToggleButton > ( "UseOverflowContentRootDynamicWidthCheckBox" ) ;
1111
+
1112
+ Log . Comment ( "OverflowContentRootDynamicWidthChangedCheckBox" ) ;
1113
+ ToggleButton overflowContentRootDynamicWidthChangedCheckBox = FindElement . ById < ToggleButton > ( "OverflowContentRootDynamicWidthChangedCheckBox" ) ;
1114
+
1115
+ Log . Comment ( "Retrieving DynamicWidthTimerIntervalTextBox" ) ;
1116
+ Edit dynamicWidthTimerIntervalTextBox = new Edit ( FindElement . ById ( "DynamicWidthTimerIntervalTextBox" ) ) ;
1117
+
1118
+ Log . Comment ( "Retrieving DynamicWidthChangeCountTextBox" ) ;
1119
+ Edit dynamicWidthChangeCountTextBox = new Edit ( FindElement . ById ( "DynamicWidthChangeCountTextBox" ) ) ;
1120
+
1121
+ Verify . AreEqual ( ToggleState . Off , isFlyoutOpenCheckBox . ToggleState ) ;
1122
+
1123
+ Log . Comment ( "Change the fifth command bar element's Visibility property asynchronously after the command bar is opened" ) ;
1124
+ useOverflowContentRootDynamicWidthCheckBox . Check ( ) ;
1125
+
1126
+ Log . Comment ( "Setting DynamicWidthTimerIntervalTextBox to 1s" ) ;
1127
+ dynamicWidthTimerIntervalTextBox . SetValue ( "1000" ) ;
1128
+
1129
+ Log . Comment ( "Setting DynamicWidthChangeCountTextBox to 1 single change" ) ;
1130
+ dynamicWidthChangeCountTextBox . SetValue ( "1" ) ;
1131
+ Wait . ForIdle ( ) ;
1132
+
1133
+ Verify . AreEqual ( ToggleState . Off , overflowContentRootDynamicWidthChangedCheckBox . ToggleState ) ;
1134
+
1135
+ Log . Comment ( "Invoking button 'Show CommandBarFlyout with no primary commands' to show the Flyout6 command bar." ) ;
1136
+ showCommandBarFlyoutButton . Invoke ( ) ;
1137
+ Wait . ForIdle ( ) ;
1138
+ Verify . AreEqual ( ToggleState . On , isFlyoutOpenCheckBox . ToggleState ) ;
1139
+
1140
+ FocusHelper . SetFocus ( FindElement . ById ( "UndoButton6" ) ) ;
1141
+
1142
+ Button undoButton6 = FindElement . ById < Button > ( "UndoButton6" ) ;
1143
+ Verify . IsNotNull ( undoButton6 ) ;
1144
+
1145
+ UIObject commandBarElementsContainer = undoButton6 . Parent ;
1146
+ Verify . IsNotNull ( commandBarElementsContainer ) ;
1147
+
1148
+ Rectangle initialBoundingRectangle = commandBarElementsContainer . BoundingRectangle ;
1149
+
1150
+ Log . Comment ( "Initial commandBarElementsContainer.BoundingRectangle.Width=" + initialBoundingRectangle . Width ) ;
1151
+ Log . Comment ( "Initial commandBarElementsContainer.BoundingRectangle.Height=" + initialBoundingRectangle . Height ) ;
1152
+
1153
+ Verify . AreEqual ( ToggleState . Off , overflowContentRootDynamicWidthChangedCheckBox . ToggleState ) ;
1154
+
1155
+ Log . Comment ( "Waiting for OverflowContentRootDynamicWidthChangedCheckBox becoming checked indicating the asynchronous Visibility property change occurred" ) ;
1156
+ overflowContentRootDynamicWidthChangedCheckBox . GetToggledWaiter ( ) . Wait ( ) ;
1157
+ Wait . ForIdle ( ) ;
1158
+
1159
+ Rectangle finalBoundingRectangle = commandBarElementsContainer . BoundingRectangle ;
1160
+
1161
+ Log . Comment ( "Final commandBarElementsContainer.BoundingRectangle.Width=" + finalBoundingRectangle . Width ) ;
1162
+ Log . Comment ( "Final commandBarElementsContainer.BoundingRectangle.Height=" + finalBoundingRectangle . Height ) ;
1163
+
1164
+ Log . Comment ( "Hitting Escape key to close the command bar." ) ;
1165
+ KeyboardHelper . PressKey ( Key . Escape ) ;
1166
+ Wait . ForIdle ( ) ;
1167
+
1168
+ Verify . AreEqual ( ToggleState . Off , isFlyoutOpenCheckBox . ToggleState ) ;
1169
+
1170
+ Log . Comment ( "Verifying the command bar flyout width was increased to accommodate the OverflowContentRoot's larger Width." ) ;
1171
+ Verify . IsGreaterThan ( finalBoundingRectangle . Width , initialBoundingRectangle . Width ) ;
1172
+ Verify . AreEqual ( finalBoundingRectangle . Height , initialBoundingRectangle . Height ) ;
1173
+ }
1174
+ }
1175
+
1008
1176
[ TestMethod ]
1009
1177
public void VerifyIsFlyoutKeyboardAccessibleWithNoPrimaryCommands ( )
1010
1178
{
0 commit comments