@ -6,27 +6,27 @@ using Xunit;
namespace Avalonia.Controls.UnitTests ;
public class App BarButtonTests : ScopedTestBase
public class Command BarButtonTests : ScopedTestBase
{
[Fact]
public void Label_DefaultIsNull ( )
= > Assert . Null ( new App BarButton( ) . Label ) ;
= > Assert . Null ( new Command BarButton( ) . Label ) ;
[Fact]
public void Label_RoundTrip ( )
{
var btn = new App BarButton { Label = "Save" } ;
var btn = new Command BarButton { Label = "Save" } ;
Assert . Equal ( "Save" , btn . Label ) ;
}
[Fact]
public void Icon_DefaultIsNull ( )
= > Assert . Null ( new App BarButton( ) . Icon ) ;
= > Assert . Null ( new Command BarButton( ) . Icon ) ;
[Fact]
public void Icon_RoundTrip ( )
{
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
var icon = new object ( ) ;
btn . Icon = icon ;
Assert . Same ( icon , btn . Icon ) ;
@ -34,72 +34,72 @@ public class AppBarButtonTests : ScopedTestBase
[Fact]
public void IsCompact_DefaultIsFalse ( )
= > Assert . False ( new App BarButton( ) . IsCompact ) ;
= > Assert . False ( new Command BarButton( ) . IsCompact ) ;
[Fact]
public void IsCompact_RoundTrip ( )
{
var btn = new App BarButton { IsCompact = true } ;
var btn = new Command BarButton { IsCompact = true } ;
Assert . True ( btn . IsCompact ) ;
}
[Fact]
public void DynamicOverflowOrder_DefaultIsZero ( )
= > Assert . Equal ( 0 , new App BarButton( ) . DynamicOverflowOrder ) ;
= > Assert . Equal ( 0 , new Command BarButton( ) . DynamicOverflowOrder ) ;
[Fact]
public void DynamicOverflowOrder_RoundTrip ( )
{
var btn = new App BarButton { DynamicOverflowOrder = 3 } ;
var btn = new Command BarButton { DynamicOverflowOrder = 3 } ;
Assert . Equal ( 3 , btn . DynamicOverflowOrder ) ;
}
[Fact]
public void LabelPosition_DefaultIsBottom ( )
= > Assert . Equal ( CommandBarDefaultLabelPosition . Bottom , new App BarButton( ) . LabelPosition ) ;
= > Assert . Equal ( CommandBarDefaultLabelPosition . Bottom , new Command BarButton( ) . LabelPosition ) ;
[Fact]
public void LabelPosition_RoundTrip ( )
{
var btn = new App BarButton { LabelPosition = CommandBarDefaultLabelPosition . Right } ;
var btn = new Command BarButton { LabelPosition = CommandBarDefaultLabelPosition . Right } ;
Assert . Equal ( CommandBarDefaultLabelPosition . Right , btn . LabelPosition ) ;
}
[Fact]
public void IsInOverflow_DefaultIsFalse ( )
= > Assert . False ( new App BarButton( ) . IsInOverflow ) ;
= > Assert . False ( new Command BarButton( ) . IsInOverflow ) ;
[Fact]
public void IsInOverflow_RoundTrip ( )
{
var btn = new App BarButton { IsInOverflow = true } ;
var btn = new Command BarButton { IsInOverflow = true } ;
Assert . True ( btn . IsInOverflow ) ;
}
[Fact]
public void ImplementsICommandBarElement ( )
= > Assert . IsAssignableFrom < ICommandBarElement > ( new App BarButton( ) ) ;
= > Assert . IsAssignableFrom < ICommandBarElement > ( new Command BarButton( ) ) ;
[Fact]
public void ICommandBarElement_IsCompact_ReadWrite ( )
{
ICommandBarElement elem = new App BarButton( ) ;
ICommandBarElement elem = new Command BarButton( ) ;
elem . IsCompact = true ;
Assert . True ( elem . IsCompact ) ;
}
[Fact]
public void Command_DefaultIsNull ( )
= > Assert . Null ( new App BarButton( ) . Command ) ;
= > Assert . Null ( new Command BarButton( ) . Command ) ;
[Fact]
public void CommandParameter_DefaultIsNull ( )
= > Assert . Null ( new App BarButton( ) . CommandParameter ) ;
= > Assert . Null ( new Command BarButton( ) . CommandParameter ) ;
[Fact]
public void Command_RoundTrip ( )
{
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
var cmd = new DelegateCommand ( _ = > { } ) ;
btn . Command = cmd ;
Assert . Same ( cmd , btn . Command ) ;
@ -108,85 +108,85 @@ public class AppBarButtonTests : ScopedTestBase
[Fact]
public void CommandParameter_RoundTrip ( )
{
var btn = new App BarButton { CommandParameter = "param" } ;
var btn = new Command BarButton { CommandParameter = "param" } ;
Assert . Equal ( "param" , btn . CommandParameter ) ;
}
}
public class App BarToggleButtonTests : ScopedTestBase
public class Command BarToggleButtonTests : ScopedTestBase
{
[Fact]
public void Label_DefaultIsNull ( )
= > Assert . Null ( new App BarToggleButton( ) . Label ) ;
= > Assert . Null ( new Command BarToggleButton( ) . Label ) ;
[Fact]
public void Label_RoundTrip ( )
{
var btn = new App BarToggleButton { Label = "Bold" } ;
var btn = new Command BarToggleButton { Label = "Bold" } ;
Assert . Equal ( "Bold" , btn . Label ) ;
}
[Fact]
public void Icon_DefaultIsNull ( )
= > Assert . Null ( new App BarToggleButton( ) . Icon ) ;
= > Assert . Null ( new Command BarToggleButton( ) . Icon ) ;
[Fact]
public void IsCompact_DefaultIsFalse ( )
= > Assert . False ( new App BarToggleButton( ) . IsCompact ) ;
= > Assert . False ( new Command BarToggleButton( ) . IsCompact ) ;
[Fact]
public void IsCompact_RoundTrip ( )
{
var btn = new App BarToggleButton { IsCompact = true } ;
var btn = new Command BarToggleButton { IsCompact = true } ;
Assert . True ( btn . IsCompact ) ;
}
[Fact]
public void DynamicOverflowOrder_DefaultIsZero ( )
= > Assert . Equal ( 0 , new App BarToggleButton( ) . DynamicOverflowOrder ) ;
= > Assert . Equal ( 0 , new Command BarToggleButton( ) . DynamicOverflowOrder ) ;
[Fact]
public void DynamicOverflowOrder_RoundTrip ( )
{
var btn = new App BarToggleButton { DynamicOverflowOrder = 5 } ;
var btn = new Command BarToggleButton { DynamicOverflowOrder = 5 } ;
Assert . Equal ( 5 , btn . DynamicOverflowOrder ) ;
}
[Fact]
public void LabelPosition_DefaultIsBottom ( )
= > Assert . Equal ( CommandBarDefaultLabelPosition . Bottom , new App BarToggleButton( ) . LabelPosition ) ;
= > Assert . Equal ( CommandBarDefaultLabelPosition . Bottom , new Command BarToggleButton( ) . LabelPosition ) ;
[Fact]
public void LabelPosition_RoundTrip ( )
{
var btn = new App BarToggleButton { LabelPosition = CommandBarDefaultLabelPosition . Collapsed } ;
var btn = new Command BarToggleButton { LabelPosition = CommandBarDefaultLabelPosition . Collapsed } ;
Assert . Equal ( CommandBarDefaultLabelPosition . Collapsed , btn . LabelPosition ) ;
}
[Fact]
public void IsInOverflow_DefaultIsFalse ( )
= > Assert . False ( new App BarToggleButton( ) . IsInOverflow ) ;
= > Assert . False ( new Command BarToggleButton( ) . IsInOverflow ) ;
[Fact]
public void ImplementsICommandBarElement ( )
= > Assert . IsAssignableFrom < ICommandBarElement > ( new App BarToggleButton( ) ) ;
= > Assert . IsAssignableFrom < ICommandBarElement > ( new Command BarToggleButton( ) ) ;
[Fact]
public void ICommandBarElement_IsCompact_ReadWrite ( )
{
ICommandBarElement elem = new App BarToggleButton( ) ;
ICommandBarElement elem = new Command BarToggleButton( ) ;
elem . IsCompact = true ;
Assert . True ( elem . IsCompact ) ;
}
[Fact]
public void Command_DefaultIsNull ( )
= > Assert . Null ( new App BarToggleButton( ) . Command ) ;
= > Assert . Null ( new Command BarToggleButton( ) . Command ) ;
[Fact]
public void Command_RoundTrip ( )
{
var btn = new App BarToggleButton( ) ;
var btn = new Command BarToggleButton( ) ;
var cmd = new DelegateCommand ( _ = > { } ) ;
btn . Command = cmd ;
Assert . Same ( cmd , btn . Command ) ;
@ -195,43 +195,47 @@ public class AppBarToggleButtonTests : ScopedTestBase
[Fact]
public void CommandParameter_RoundTrip ( )
{
var btn = new App BarToggleButton { CommandParameter = 4 2 } ;
var btn = new Command BarToggleButton { CommandParameter = 4 2 } ;
Assert . Equal ( 4 2 , btn . CommandParameter ) ;
}
}
public class App BarSeparatorTests : ScopedTestBase
public class Command BarSeparatorTests : ScopedTestBase
{
[Fact]
public void IsCompact_DefaultIsFalse ( )
= > Assert . False ( new App BarSeparator( ) . IsCompact ) ;
= > Assert . False ( new Command BarSeparator( ) . IsCompact ) ;
[Fact]
public void IsCompact_RoundTrip ( )
{
var sep = new App BarSeparator { IsCompact = true } ;
var sep = new Command BarSeparator { IsCompact = true } ;
Assert . True ( sep . IsCompact ) ;
}
[Fact]
public void IsInOverflow_DefaultIsFalse ( )
= > Assert . False ( new App BarSeparator( ) . IsInOverflow ) ;
= > Assert . False ( new Command BarSeparator( ) . IsInOverflow ) ;
[Fact]
public void IsInOverflow_RoundTrip ( )
{
var sep = new App BarSeparator { IsInOverflow = true } ;
var sep = new Command BarSeparator { IsInOverflow = true } ;
Assert . True ( sep . IsInOverflow ) ;
}
[Fact]
public void ImplementsICommandBarElement ( )
= > Assert . IsAssignableFrom < ICommandBarElement > ( new AppBarSeparator ( ) ) ;
= > Assert . IsAssignableFrom < ICommandBarElement > ( new CommandBarSeparator ( ) ) ;
[Fact]
public void DerivesFromSeparator ( )
= > Assert . IsAssignableFrom < Separator > ( new CommandBarSeparator ( ) ) ;
[Fact]
public void ICommandBarElement_IsCompact_ReadWrite ( )
{
ICommandBarElement elem = new App BarSeparator( ) ;
ICommandBarElement elem = new Command BarSeparator( ) ;
elem . IsCompact = true ;
Assert . True ( elem . IsCompact ) ;
}
@ -517,7 +521,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void PrimaryCommands_Added_AppearInVisiblePrimary_WhenDynamicOverflowDisabled ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Save" } ;
var btn = new Command BarButton { Label = "Save" } ;
cb . PrimaryCommands ! . Add ( btn ) ;
Assert . Contains ( btn , cb . VisiblePrimaryCommands ) ;
}
@ -530,7 +534,7 @@ public class CommandBarCollectionTests : ScopedTestBase
( ( INotifyCollectionChanged ) cb . VisiblePrimaryCommands ) . CollectionChanged + = ( _ , _ ) = > notifications + + ;
cb . PrimaryCommands ! . Add ( new App BarButton { Label = "Save" } ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton { Label = "Save" } ) ;
Assert . Equal ( 2 , notifications ) ;
}
@ -539,7 +543,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void PrimaryCommands_Removed_DisappearsFromVisiblePrimary ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Save" } ;
var btn = new Command BarButton { Label = "Save" } ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . PrimaryCommands ! . Remove ( btn ) ;
Assert . DoesNotContain ( btn , cb . VisiblePrimaryCommands ) ;
@ -549,7 +553,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void SecondaryCommands_Added_AppearInOverflowItems ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Settings" } ;
var btn = new Command BarButton { Label = "Settings" } ;
cb . SecondaryCommands ! . Add ( btn ) ;
Assert . Contains ( btn , cb . OverflowItems ) ;
}
@ -562,7 +566,7 @@ public class CommandBarCollectionTests : ScopedTestBase
( ( INotifyCollectionChanged ) cb . OverflowItems ) . CollectionChanged + = ( _ , _ ) = > notifications + + ;
cb . SecondaryCommands ! . Add ( new App BarButton { Label = "Settings" } ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton { Label = "Settings" } ) ;
Assert . Equal ( 2 , notifications ) ;
}
@ -571,7 +575,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void SecondaryCommands_Removed_DisappearsFromOverflowItems ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Settings" } ;
var btn = new Command BarButton { Label = "Settings" } ;
cb . SecondaryCommands ! . Add ( btn ) ;
cb . SecondaryCommands ! . Remove ( btn ) ;
Assert . DoesNotContain ( btn , cb . OverflowItems ) ;
@ -581,7 +585,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void HasSecondaryCommands_TrueWhenSecondaryAdded ( )
{
var cb = new CommandBar ( ) ;
cb . SecondaryCommands ! . Add ( new App BarButton { Label = "Options" } ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton { Label = "Options" } ) ;
Assert . True ( cb . HasSecondaryCommands ) ;
}
@ -589,7 +593,7 @@ public class CommandBarCollectionTests : ScopedTestBase
public void HasSecondaryCommands_FalseAfterSecondaryCleared ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Options" } ;
var btn = new Command BarButton { Label = "Options" } ;
cb . SecondaryCommands ! . Add ( btn ) ;
cb . SecondaryCommands ! . Remove ( btn ) ;
Assert . False ( cb . HasSecondaryCommands ) ;
@ -599,8 +603,8 @@ public class CommandBarCollectionTests : ScopedTestBase
public void OverflowItems_CountMatchesSecondaryCommandCount ( )
{
var cb = new CommandBar ( ) ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
Assert . Equal ( 2 , cb . OverflowItems . Count ) ;
}
@ -608,8 +612,8 @@ public class CommandBarCollectionTests : ScopedTestBase
public void VisiblePrimaryCommands_CountMatchesPrimary_WhenDynamicOverflowDisabled ( )
{
var cb = new CommandBar ( ) ;
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
Assert . Equal ( 2 , cb . VisiblePrimaryCommands . Count ) ;
}
@ -617,9 +621,9 @@ public class CommandBarCollectionTests : ScopedTestBase
public void MultiplePrimaryCommands_AllVisibleInOrder ( )
{
var cb = new CommandBar ( ) ;
var btn1 = new App BarButton { Label = "A" } ;
var btn2 = new App BarButton { Label = "B" } ;
var btn3 = new App BarButton { Label = "C" } ;
var btn1 = new Command BarButton { Label = "A" } ;
var btn2 = new Command BarButton { Label = "B" } ;
var btn3 = new Command BarButton { Label = "C" } ;
cb . PrimaryCommands ! . Add ( btn1 ) ;
cb . PrimaryCommands ! . Add ( btn2 ) ;
cb . PrimaryCommands ! . Add ( btn3 ) ;
@ -627,19 +631,19 @@ public class CommandBarCollectionTests : ScopedTestBase
}
[Fact]
public void App BarSeparator_CanBeAddedToPrimaryCommands( )
public void Command BarSeparator_CanBeAddedToPrimaryCommands( )
{
var cb = new CommandBar ( ) ;
var sep = new App BarSeparator( ) ;
var sep = new Command BarSeparator( ) ;
cb . PrimaryCommands ! . Add ( sep ) ;
Assert . Contains ( sep , cb . VisiblePrimaryCommands ) ;
}
[Fact]
public void App BarToggleButton_CanBeAddedToPrimaryCommands( )
public void Command BarToggleButton_CanBeAddedToPrimaryCommands( )
{
var cb = new CommandBar ( ) ;
var toggle = new App BarToggleButton { Label = "Bold" } ;
var toggle = new Command BarToggleButton { Label = "Bold" } ;
cb . PrimaryCommands ! . Add ( toggle ) ;
Assert . Contains ( toggle , cb . VisiblePrimaryCommands ) ;
}
@ -651,7 +655,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Collapsed_SetsIsCompactOnExistingPrimaryButton ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -663,7 +667,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Bottom_ClearsIsCompactOnPrimaryButton ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -676,7 +680,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Right_SetsLabelPositionOnPrimaryButton ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Right ;
@ -688,7 +692,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Collapsed_SetsLabelPositionOnPrimaryButton ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -700,7 +704,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Collapsed_PropagatesIsCompactToToggleButton ( )
{
var cb = new CommandBar ( ) ;
var toggle = new App BarToggleButton( ) ;
var toggle = new Command BarToggleButton( ) ;
cb . PrimaryCommands ! . Add ( toggle ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -713,7 +717,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Right_PropagatesLabelPositionToToggleButton ( )
{
var cb = new CommandBar ( ) ;
var toggle = new App BarToggleButton( ) ;
var toggle = new Command BarToggleButton( ) ;
cb . PrimaryCommands ! . Add ( toggle ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Right ;
@ -725,7 +729,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Collapsed_SetsIsCompactOnSeparator ( )
{
var cb = new CommandBar ( ) ;
var sep = new App BarSeparator( ) ;
var sep = new Command BarSeparator( ) ;
cb . PrimaryCommands ! . Add ( sep ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -738,7 +742,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
{
var cb = new CommandBar { DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed } ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
Assert . True ( btn . IsCompact ) ;
@ -750,7 +754,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
{
var cb = new CommandBar { DefaultLabelPosition = CommandBarDefaultLabelPosition . Right } ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . PrimaryCommands ! . Add ( btn ) ;
Assert . Equal ( CommandBarDefaultLabelPosition . Right , btn . LabelPosition ) ;
@ -760,7 +764,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_Collapsed_AppliesToSecondaryCommands ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . SecondaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -772,7 +776,7 @@ public class CommandBarLabelPositionTests : ScopedTestBase
public void DefaultLabelPosition_DoesNotClearLabelText ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton { Label = "Save" } ;
var btn = new Command BarButton { Label = "Save" } ;
cb . PrimaryCommands ! . Add ( btn ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
@ -801,7 +805,7 @@ public class CommandBarOverflowButtonTests : ScopedTestBase
public void OverflowButtonVisibility_Auto_TrueWhenHasSecondaryCommands ( )
{
var cb = new CommandBar ( ) ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
Assert . True ( cb . IsOverflowButtonVisible ) ;
}
@ -823,7 +827,7 @@ public class CommandBarOverflowButtonTests : ScopedTestBase
public void OverflowButtonVisibility_Collapsed_RemainsFalseEvenWithSecondary ( )
{
var cb = new CommandBar { OverflowButtonVisibility = CommandBarOverflowButtonVisibility . Collapsed } ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
Assert . False ( cb . IsOverflowButtonVisible ) ;
}
@ -831,7 +835,7 @@ public class CommandBarOverflowButtonTests : ScopedTestBase
public void OverflowButtonVisibility_Auto_FalseAfterSecondaryRemoved ( )
{
var cb = new CommandBar ( ) ;
var btn = new App BarButton( ) ;
var btn = new Command BarButton( ) ;
cb . SecondaryCommands ! . Add ( btn ) ;
Assert . True ( cb . IsOverflowButtonVisible ) ;
@ -863,9 +867,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
public void ItemWidthBottom_Controls_HowManyButtonsFit ( )
{
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ; // forces overflow button
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ; // forces overflow button
for ( int i = 0 ; i < 4 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 3 , cb . VisiblePrimaryCommands . Count ) ;
@ -877,9 +881,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
{
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . ItemWidthBottom = 3 5 ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 4 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 4 , cb . VisiblePrimaryCommands . Count ) ;
@ -890,9 +894,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
{
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . ItemWidthBottom = 2 6 0 ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 3 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 1 , cb . VisiblePrimaryCommands . Count ) ;
@ -903,9 +907,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
{
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Right ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 4 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 2 , cb . VisiblePrimaryCommands . Count ) ;
@ -917,9 +921,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Right ;
cb . ItemWidthRight = 2 5 2 ; // exactly 1 fits: 252/252=1
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 3 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 1 , cb . VisiblePrimaryCommands . Count ) ;
@ -930,9 +934,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
{
var cb = CreateWithWidth ( 3 0 0 ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Collapsed ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 4 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . IsDynamicOverflowEnabled = true ;
Assert . Equal ( 4 , cb . VisiblePrimaryCommands . Count ) ;
@ -945,9 +949,9 @@ public class CommandBarItemWidthTests : ScopedTestBase
cb . ItemWidthBottom = 7 0 ;
cb . ItemWidthRight = 1 0 2 ;
cb . ItemWidthCollapsed = 4 2 ;
cb . SecondaryCommands ! . Add ( new App BarButton( ) ) ;
cb . SecondaryCommands ! . Add ( new Command BarButton( ) ) ;
for ( int i = 0 ; i < 4 ; i + + )
cb . PrimaryCommands ! . Add ( new App BarButton( ) ) ;
cb . PrimaryCommands ! . Add ( new Command BarButton( ) ) ;
cb . DefaultLabelPosition = CommandBarDefaultLabelPosition . Bottom ;
cb . IsDynamicOverflowEnabled = true ;