public void TestPosition() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; window.Left = 10.0; window.Top = 11.0; double margin = Workspace.Current.Configuration.DesktopMargin; { // when WindowOperator.GetInstance().SetValue(WindowOperator.PositionProperty, Position.Current); // then Assert.AreEqual(10.0, window.Left); Assert.AreEqual(11.0, window.Top); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.PositionProperty, Position.LeftBottom); // then Assert.AreEqual(margin, window.Left); Assert.AreEqual(window.ScreenHeight - margin, window.Top); } }
public void TestBeginAnimation() { try { // when WindowOperator.GetInstance().BeginAnimation(null, null, HandoffBehavior.Compose); Assert.Fail(); } catch (NotImplementedException e) { // then Console.WriteLine(e); } try { // when WindowOperator.GetInstance().BeginAnimation(null, null); Assert.Fail(); } catch (NotImplementedException e) { // then Console.WriteLine(e); } }
public void TestConstructor() { // when SlideIn slideIn = new SlideIn(); // then Assert.AreSame(WindowOperator.GetInstance(), Storyboard.GetTarget(slideIn)); Assert.AreEqual(TimeSpan.FromSeconds(1), slideIn.Duration); }
public void TestConstructor() { // when Operation operation = new Operation(); // then Assert.AreEqual(new Duration(TimeSpan.FromMilliseconds(10)), operation.Duration); Assert.AreSame(WindowOperator.GetInstance(), Storyboard.GetTarget(operation)); Assert.AreEqual("Command", Storyboard.GetTargetProperty(operation).Path); }
public void TestConstructor() { // when Locate locate = new Locate(); // then Assert.AreEqual(new Duration(TimeSpan.FromMilliseconds(10)), locate.Duration); Assert.AreSame(WindowOperator.GetInstance(), Storyboard.GetTarget(locate)); Assert.AreEqual("Position", Storyboard.GetTargetProperty(locate).Path); }
protected internal override object GetCurrentValue( object defaultOriginValue, object defaultDestinationValue, double clockValue) { if (!this.located) { WindowOperator.GetInstance().SetValue(WindowOperator.PositionProperty, this.Position); this.located = true; } return(base.GetCurrentValue(defaultOriginValue, defaultDestinationValue, clockValue)); }
public void TestTop() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; // when WindowOperator.GetInstance().SetValue(WindowOperator.TopProperty, 10.0); // then Assert.AreEqual(10.0, window.Top); }
public void TestGetAnimationBaseValue() { try { // when WindowOperator.GetInstance().GetAnimationBaseValue(null); Assert.Fail(); } catch (NotImplementedException e) { // then Console.WriteLine(e); } }
public void TestOpacity() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; window.Opacity = 1.0; // when WindowOperator.GetInstance().SetValue(WindowOperator.OpacityProperty, 0.5); // then Assert.AreEqual(0.5, window.Opacity); }
public void TestHasAnimatedProperties() { try { // when bool b = WindowOperator.GetInstance().HasAnimatedProperties; Assert.Fail(); } catch (NotImplementedException e) { // then Console.WriteLine(e); } }
public void TestGetCurrentValue() { // setup FadeIn fade = new FadeIn(); fade.Position = Position.CenterTop; MainWindow.Current = new MainWindow(); MainWindow.Current.Opacity = 0.0; // when Assert.AreEqual(0.0, fade.GetCurrentValue(null, null, 0.0)); Assert.AreEqual(0.5, fade.GetCurrentValue(null, null, 0.5)); Assert.AreEqual(1.0, fade.GetCurrentValue(null, null, 1.0)); Assert.AreEqual(Position.CenterTop, WindowOperator.GetInstance().GetValue(WindowOperator.PositionProperty)); }
public void TestCommand() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; window.Opacity = 1.0; window.WindowState = WindowState.Normal; { // when WindowOperator.GetInstance().SetValue(WindowOperator.CommandProperty, Command.Hide); // then Assert.AreEqual(0.0, window.Opacity); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.CommandProperty, Command.Show); // then Assert.AreEqual(1.0, window.Opacity); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.CommandProperty, Command.Maximize); // then Assert.AreEqual(WindowState.Maximized, window.WindowState); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.CommandProperty, Command.Minimize); // then Assert.AreEqual(WindowState.Minimized, window.WindowState); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.CommandProperty, Command.Normalize); // then Assert.AreEqual(WindowState.Normal, window.WindowState); } }
public void TestLeft() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; { // when WindowOperator.GetInstance().SetValue(WindowOperator.LeftProperty, 10.0); // then Assert.AreEqual(10.0, window.Left); } { // when WindowOperator.GetInstance().SetValue(WindowOperator.LeftProperty, null); // then Assert.AreEqual(10.0, window.Left); } }
public Locate() { this.Duration = new Duration(TimeSpan.FromMilliseconds(10)); Storyboard.SetTarget(this, WindowOperator.GetInstance()); Storyboard.SetTargetProperty(this, new PropertyPath("Position")); }
protected WindowAnimationBase() : base() { Storyboard.SetTarget(this, WindowOperator.GetInstance()); this.Duration = new Duration(TimeSpan.FromSeconds(1)); }
public void TestGetInstance() { // expect Assert.AreSame(WindowOperator.GetInstance(), WindowOperator.GetInstance()); }