Xamarin.Forms/Xamarin.Forms.Core.UnitTests/CheckBoxUnitTests.cs

49 строки
817 B
C#
Исходник Постоянная ссылка Обычный вид История

Checkbox (#6232) * Add CheckBox class and Renderer * Add CheckBoxCell class * Add Control Gallery for CheckBox and CheckBoxCell. Add stubs only for Android for now. * Update to fast renderer for Android, Implement Checked and Unchecked Colors! * Initial UWP implementation, no colors yet. * Add iOS implementation for checkbox. It's not pretty, but it is a start! * Updates from Frank * Code cleanup with frank * Finalize iOS checkbox!!! it is a circle! * Fix WPF build and Add a checkbox!!! * Cell Renderers and macOS * UWP switchcell * Update CheckBox Cell on ios/android with colors * Remove all instances of CheckBoxCell per demand * Added UITests and UnitTests * Changed colors to TintColor which makes sense. Added a IsChecked visual state property and a sample! * checkbox cleanup, tint color fixes, and material * uwp fix when changing TintBrush * add checkbox to visual controls page * formatting fix * formatting fix * formatting fix * convert to tabs * formatting * checkbox tabs * roll back formatting changes to WPFResources * android renderer overrides * uwp fix and sizing fix ios * mask checkbox * use a single image for ios inatead of always drawing new ones * wpf fix * rename to color and add css interfaces * missing wpf file * designer hack * fix wpf for ios builds * assembly info * fix default tint color and infinite crash * [iOS] fixes change checked state from control simplification added to dynamic galery * [iOS material] fix crash when dispose * [UWP, WPF] fix vertical alignment * [Android] fixes does not change size when the reduction HeightRequest * Update Xamarin.Forms.Material.iOS/MaterialCheckboxRenderer.cs Co-Authored-By: Samantha Houts <samhouts@users.noreply.github.com> * [Android] TabStop support * alphabetize gallery, fix color update when disabled, unsubscribe from event in dispose * cleanup assembly info * fix assembly attributes * remove assembly info * pr comments * couple of more dispose fixes * One Last Dispose * fix api 19 call to ClipToOutline
2019-05-30 19:32:28 +03:00
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace Xamarin.Forms.Core.UnitTests
{
[TestFixture]
public class CheckBoxUnitTests : BaseTestFixture
{
[Test]
public void TestConstructor()
{
var checkBox = new CheckBox();
Assert.IsFalse(checkBox.IsChecked);
}
[Test]
public void TestOnEvent()
{
var checkBox = new CheckBox();
var fired = false;
checkBox.CheckedChanged += (sender, e) => fired = true;
checkBox.IsChecked = true;
Assert.IsTrue(fired);
}
[Test]
public void TestOnEventNotDoubleFired()
{
var checkBox = new CheckBox();
bool fired = false;
checkBox.IsChecked = true;
checkBox.CheckedChanged += (sender, args) => fired = true;
checkBox.IsChecked = true;
Assert.IsFalse(fired);
}
}
}