RadioButtonTests.cs 986 B

123456789101112131415161718192021222324252627282930313233343536
  1. using Avalonia.Markup.Xaml.Data;
  2. using Avalonia.UnitTests;
  3. using Xunit;
  4. namespace Avalonia.Controls.UnitTests
  5. {
  6. public class RadioButtonTests
  7. {
  8. [Theory]
  9. [InlineData(false)]
  10. [InlineData(true)]
  11. public void Indeterminate_RadioButton_Is_Not_Unchecked_After_Checking_Other_Radio_Button(bool isThreeState)
  12. {
  13. var panel = new Panel();
  14. var radioButton1 = new RadioButton();
  15. radioButton1.IsThreeState = false;
  16. radioButton1.IsChecked = false;
  17. var radioButton2 = new RadioButton();
  18. radioButton2.IsThreeState = isThreeState;
  19. radioButton2.IsChecked = null;
  20. panel.Children.Add(radioButton1);
  21. panel.Children.Add(radioButton2);
  22. Assert.Null(radioButton2.IsChecked);
  23. radioButton1.IsChecked = true;
  24. Assert.True(radioButton1.IsChecked);
  25. Assert.Null(radioButton2.IsChecked);
  26. }
  27. }
  28. }