public void TestAddWindow3() { RectangleView r1 = new RectangleView(); RectangleView r2 = new RectangleView(); WindowsView wv = new WindowsView(); WindowsView.Window wv1 = wv.AddWindow(r1); // To get an offset on wv2 WindowsView.Window wv2 = wv.AddWindow(r2); Assert.AreEqual(new Point(10, 10), wv2.Position); }
public void TestRemoveWindow() { RectangleView r1 = new RectangleView(); RectangleView r2 = new RectangleView(); WindowsView wv = new WindowsView(); WindowsView.Window wv1 = wv.AddWindow(r1); // To get an offset on wv2 WindowsView.Window wv2 = wv.AddWindow(r2); wv.RemoveWindowWith(r2); Assert.AreEqual(false, wv.Children.Contains(wv2)); }
public void TestAddWindow2() { RectangleView r = new RectangleView(); WindowsView wv = new WindowsView(); WindowsView.Window wvNew = wv.AddWindow(r); Assert.AreEqual(500, wvNew.Width); }
public void Test() { var windowsView = new WindowsView(); var button = new Button() { Label = "Add" }; var textBoxTerm1 = new TextBox(); var textBoxTerm2 = new TextBox(); var solutionLabel = new LabelView(); var panel = new StackPanel() { Children = { textBoxTerm1, textBoxTerm2, button, solutionLabel }, StackOrientation = Orientation.Vertical }; windowsView.AddWindow(panel); button.OnButtonClick.Subscribe(_ => { if (!int.TryParse(textBoxTerm1.Text, out int term1) || !int.TryParse(textBoxTerm2.Text, out int term2)) { solutionLabel.Text = "Invalid input"; } else { solutionLabel.Text = (term1 + term2).ToString(); } }); textBoxTerm1.Text = 5.ToString(); textBoxTerm2.Text = 6.ToString(); UIElement.HandleMouseEvent(windowsView, new MouseEventData(MouseEvent.MOUSE_RELEASED, button.TranslatePointTo(windowsView, button.Position), 1)); Assert.AreEqual("11", solutionLabel.Text); textBoxTerm1.Text = "term 1"; textBoxTerm2.Text = "term 2"; UIElement.HandleMouseEvent(windowsView, new MouseEventData(MouseEvent.MOUSE_RELEASED, button.TranslatePointTo(windowsView, button.Position), 1)); Assert.AreEqual("Invalid input", solutionLabel.Text); //var main = new MainWindow(windowsView); }