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 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 TestConstructor() { // when SlideIn slideIn = new SlideIn(); // then Assert.AreSame(WindowOperator.GetInstance(), Storyboard.GetTarget(slideIn)); Assert.AreEqual(TimeSpan.FromSeconds(1), slideIn.Duration); }
public void TestGetTop() { // setup Workspace.Current.Configuration = new Configuration(); double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(margin, WindowOperator.GetTop(null)); }
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); }
public void TestGetMiddle() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(window.ScreenHeight / 2, WindowOperator.GetMiddle(window)); }
public void TestConvertNaNToZero() { // setup Workspace.Current.Configuration = new Configuration(); double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(margin, WindowOperator.ConvertNaNToZero(double.NaN)); Assert.AreEqual(margin, WindowOperator.ConvertNaNToZero(double.PositiveInfinity)); Assert.AreEqual(margin, WindowOperator.ConvertNaNToZero(double.NegativeInfinity)); Assert.AreEqual(1.0, WindowOperator.ConvertNaNToZero(1.0)); }
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 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 TestGetAnimationBaseValue() { try { // when WindowOperator.GetInstance().GetAnimationBaseValue(null); Assert.Fail(); } catch (NotImplementedException e) { // then Console.WriteLine(e); } }
private void Locate() { MainWindow window = MainWindow.Current; Direction direction = this.Direction; if (direction == Direction.Left || direction == Direction.Right) { window.Top = WindowOperator.GetTop(window, this.Position); } else { window.Left = WindowOperator.GetLeft(window, this.Position); } }
protected override double?GetToPropertyValue() { MainWindow window = MainWindow.Current; Direction direction = this.Direction; if (direction == Direction.Left || direction == Direction.Right) { return(WindowOperator.GetLeft(window, this.Position)); } else { return(WindowOperator.GetTop(window, this.Position)); } }
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 TestGetTopWithPosition() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(margin, WindowOperator.GetTop(window, Position.LeftTop)); Assert.AreEqual(margin, WindowOperator.GetTop(window, Position.CenterTop)); Assert.AreEqual(margin, WindowOperator.GetTop(window, Position.RightTop)); Assert.AreEqual(window.ScreenHeight / 2, WindowOperator.GetTop(window, Position.LeftMiddle)); Assert.AreEqual(window.ScreenHeight / 2, WindowOperator.GetTop(window, Position.CenterMiddle)); Assert.AreEqual(window.ScreenHeight / 2, WindowOperator.GetTop(window, Position.RightMiddle)); Assert.AreEqual(window.ScreenHeight - margin, WindowOperator.GetTop(window, Position.LeftBottom)); Assert.AreEqual(window.ScreenHeight - margin, WindowOperator.GetTop(window, Position.CenterBottom)); Assert.AreEqual(window.ScreenHeight - margin, WindowOperator.GetTop(window, Position.RightBottom)); }
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()); }