public void SetParent_entry_is_parent_and_label_is_child() { var child = new Label(); var entry = new Entry(); var page = new ContentPage(); var mgr = new DefaultSurfaceManager(); page.Content = entry; mgr.SetInspectorSurface(page); var parented = mgr.SetParent(child, entry); Assert.IsFalse(parented, "Parented should be false."); Assert.AreEqual(mgr.Root.Children[0].Id, entry.Id.ToString(), "The content view has changed."); }
public void SetParent_page_is_parent_and_label_is_child() { var label = new Label { Text = "value" }; var page = new ContentPage(); var mgr = new DefaultSurfaceManager(); mgr.SetInspectorSurface(page); var parented = mgr.SetParent(label, page); Assert.IsTrue(parented, "SetParent returned false."); Assert.AreEqual(1, mgr.Root.Children.Count, "Expected one child."); Assert.AreEqual(label.Id.ToString(), mgr.Root.Children[0].Id, "The label widget wasn't added to the children collection."); }
public void SetParent_ScrollView_is_parent_and_entry_is_child() { var child = new Label(); var content = new ScrollView(); var page = new ContentPage { Content = content }; var mgr = new DefaultSurfaceManager(); mgr.SetInspectorSurface(page); var parented = mgr.SetParent(child, content); Assert.IsTrue(parented, "Parented should be true."); var contentPair = mgr[content.Id.ToString()]; Assert.IsNotEmpty(contentPair.UIWidget.Children, "Content children should have an element."); Assert.AreEqual(contentPair.UIWidget.Children[0].Id, child.Id.ToString(), "The wrong child was attached."); }
public void SetParent_stacklayout_is_parent_and_entry_is_child() { var child = new Entry(); var layout = new StackLayout(); var page = new ContentPage(); var mgr = new DefaultSurfaceManager(); page.Content = layout; mgr.SetInspectorSurface(page); var parented = mgr.SetParent(child, layout); Assert.IsTrue(parented, "Parented returned false."); var layoutWidget = mgr[layout.Id.ToString()]; Assert.IsNotEmpty(layoutWidget.UIWidget.Children, "UIWidget did not have any children."); Assert.IsNotEmpty(layout.Children, "StackLayout view did not contain children."); }