Ejemplo n.º 1
0
		public void InvalidAdd3 ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			HBox b = new HBox ();
			b.PackStart (c1);
			co.Add (c1);
		}
Ejemplo n.º 2
0
		public void ParentIsSet ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			var c2 = new Label ("hi2");
			co.Add (c1);
			co.AddInner (c2);
			Assert.AreSame (co, c1.Parent);
			Assert.AreSame (co, c2.Parent);
		}
Ejemplo n.º 3
0
		public void ChildrenExcludesInternal ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			var c2 = new Label ("hi2");
			Assert.AreEqual (0, co.Surface.Children.Count ());
			co.Add (c1);
			Assert.AreEqual (1, co.Surface.Children.Count ());
			co.AddInner (c2);
			Assert.AreEqual (2, co.Surface.Children.Count ());
			Assert.IsTrue (co.Surface.Children.Contains (c1));
			Assert.IsTrue (co.Surface.Children.Contains (c2));
		}
Ejemplo n.º 4
0
        public void ChildrenExcludesInternal()
        {
            MyContainer co = new MyContainer();
            var         c1 = new Label("hi1");
            var         c2 = new Label("hi2");

            Assert.AreEqual(0, co.Surface.Children.Count());
            co.Add(c1);
            Assert.AreEqual(1, co.Surface.Children.Count());
            co.AddInner(c2);
            Assert.AreEqual(2, co.Surface.Children.Count());
            Assert.IsTrue(co.Surface.Children.Contains(c1));
            Assert.IsTrue(co.Surface.Children.Contains(c2));
        }
Ejemplo n.º 5
0
        public void Remove()
        {
            MyContainer co = new MyContainer();
            var         c1 = new Label("hi1");
            var         c2 = new Label("hi2");

            co.Add(c1);
            co.AddInner(c2);
            Assert.AreEqual(2, co.Surface.Children.Count());
            co.RemoveInner(c2);
            Assert.AreEqual(1, co.Surface.Children.Count());
            Assert.IsNull(c2.Parent);
            co.Remove(c1);
            Assert.AreEqual(0, co.Surface.Children.Count());
            Assert.IsNull(c1.Parent);
        }
Ejemplo n.º 6
0
        public void InternalRemoveAdd()
        {
            // The a child can be removed from internal containers and still
            // be a child of the container

            MyContainer co = new MyContainer();

            Assert.AreEqual(0, co.Surface.Children.Count());

            var c1 = new Label("hi1");

            co.Add(c1);
            Assert.AreEqual(1, co.Surface.Children.Count());

            co.InternalRemove(c1);
            Assert.AreEqual(1, co.Surface.Children.Count());
            Assert.AreSame(co, c1.Parent);

            co.InternalAdd(c1);
            Assert.AreEqual(1, co.Surface.Children.Count());
            Assert.AreSame(co, c1.Parent);
        }
Ejemplo n.º 7
0
		public void Remove ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			var c2 = new Label ("hi2");
			co.Add (c1);
			co.AddInner (c2);
			Assert.AreEqual (2, co.Surface.Children.Count ());
			co.RemoveInner (c2);
			Assert.AreEqual (1, co.Surface.Children.Count ());
			Assert.IsNull (c2.Parent);
			co.Remove (c1);
			Assert.AreEqual (0, co.Surface.Children.Count ());
			Assert.IsNull (c1.Parent);
		}
Ejemplo n.º 8
0
		public void InvalidAdd1 ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			co.InternalAdd (c1);
		}
Ejemplo n.º 9
0
		public void InternalRemoveAdd ()
		{
			// The a child can be removed from internal containers and still
			// be a child of the container

			MyContainer co = new MyContainer ();
			Assert.AreEqual (0, co.Surface.Children.Count ());

			var c1 = new Label ("hi1");
			co.Add (c1);
			Assert.AreEqual (1, co.Surface.Children.Count ());

			co.InternalRemove (c1);
			Assert.AreEqual (1, co.Surface.Children.Count ());
			Assert.AreSame (co, c1.Parent);

			co.InternalAdd (c1);
			Assert.AreEqual (1, co.Surface.Children.Count ());
			Assert.AreSame (co, c1.Parent);
		}
Ejemplo n.º 10
0
		public void InvalidRemove ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			co.Add (c1);
			co.WrongRemove (c1);
		}