public void Execute_NoArgs_SetSize() { // Arrange var webDriver = Substitute.For <IWebDriver>(); var options = Substitute.For <IOptions>(); var window = Substitute.For <IWindow>(); webDriver.Manage().Returns(options); options.Window.Returns(window); // Act _defaultCommand.Execute(webDriver); // Assert window.Received().Size = new Size(DefaultWidth, DefaultHeight); }
/// <summary> /// Draws the barcode image on an image in image viewer. /// </summary> public void DrawBarcodeImage() { if (ImageViewer != null && ImageViewer.Image != null && BarcodeImage != null && !Rectangle.Size.IsEmpty) { VintasoftImage image = ImageViewer.Image; OnImageChanging(new ImageChangedEventArgs(image)); VintasoftImage barcodeImage = BarcodeImage; bool needDisposeBarcodeImage = false; Rectangle barcodeRect = GetDestBarcodeImageRectangle(); // if image size not equals with rectangle size if (barcodeRect.Width != BarcodeImage.Width || barcodeRect.Height != BarcodeImage.Height) { // resize barcode image needDisposeBarcodeImage = true; ResizeCommand resize = new ResizeCommand(barcodeRect.Width, barcodeRect.Height); barcodeImage = resize.Execute(barcodeImage); } // draw barcode image on viewer image OverlayCommand overaly = new OverlayCommand(barcodeImage, barcodeRect.Location); overaly.ExecuteInPlace(image); if (needDisposeBarcodeImage) { barcodeImage.Dispose(); } Rectangle = Rectangle.Empty; OnImageChanged(new ImageChangedEventArgs(image)); } }
/// <summary> /// gets controls from the style /// </summary> /// <param name="e"></param> protected override void OnTemplateApplied(TemplateAppliedEventArgs e) { if (popup != null) { popup.Closed -= OnPopupClosed; popup.Opened -= OnPopupOpened; } _minimizedButtonContainer = e.NameScope.Find <Control>(partMinimizedButtonContainer); popup = e.NameScope.Find <Popup>(partPopup); if (popup != null) { popup.Closed += new EventHandler(OnPopupClosed); popup.Opened += new EventHandler(OnPopupOpened); } ToggleButton btn = e.NameScope.Find <ToggleButton>("PART_ToggleButton"); if (btn != null) { btn.PointerReleased += Btn_PointerReleased; } btnMenu = e.NameScope.Find <ToggleButton>("toggleMenu"); btnMenu.PointerLeave += (o, e) => { e.Pointer.Capture(null); }; btnMenu.Click += (o, e) => { ApplyOverflowMenu(); if (OverflowMenuItems.Count == 0) { return; } //IsOverflowVisible = !IsOverflowVisible; if (btnMenu.ContextMenu.IsOpen == false) { btnMenu.ContextMenu.Items = OverflowMenuItems; btnMenu.ContextMenu.Open(this); } else { btnMenu.ContextMenu.Close(); } }; //Border headerBorder = e.NameScope.Find<Border>("headerBorder"); //headerBorder.DoubleTapped += (o, e) => //{ // IsMaximized = !IsMaximized; //}; e.NameScope.Find <Button>("resizeButton").Click += (o, e) => { ResizeCommand.Execute(o); }; e.NameScope.Find <Button>("closeButton").Click += (o, e) => { CloseCommand.Execute(o); }; e.NameScope.Find <Button>("toggleMinimizeButton").Click += (o, e) => { CollapseCommand.Execute(o); }; e.NameScope.Find <Button>("splitter").Click += (o, e) => { StartDraggingCommand.Execute(o); }; base.OnTemplateApplied(e); RaisePropertyChanged(OdcExpanderClassesProperty, null, (Classes)OdcExpanderClasses); ApplySections(); //RaisePropertyChanged(IsOverflowVisibleProperty, !IsOverflowVisible, IsOverflowVisible); }
public void ExecuteTest() { model.GetTotalShapes.Add(new Rectangle(0, 0, 1, 1)); resizeCommand.Execute(); Assert.AreEqual(model.GetTotalShapes.Count, 1); }