예제 #1
0
        public void InvalidRemove()
        {
            MyContainer co = new MyContainer();
            var         c1 = new Label("hi1");

            co.Add(c1);
            co.WrongRemove(c1);
        }
예제 #2
0
        public void InvalidAdd3()
        {
            MyContainer co = new MyContainer();
            var         c1 = new Label("hi1");
            HBox        b  = new HBox();

            b.PackStart(c1);
            co.Add(c1);
        }
예제 #3
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);
		}
예제 #4
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);
        }
예제 #5
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));
		}
예제 #6
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));
        }
예제 #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);
        }
예제 #8
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);
        }
예제 #9
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);
		}
예제 #10
0
		public void InvalidAdd3 ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			HBox b = new HBox ();
			b.PackStart (c1);
			co.Add (c1);
		}
예제 #11
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);
		}
예제 #12
0
		public void InvalidRemove ()
		{
			MyContainer co = new MyContainer ();
			var c1 = new Label ("hi1");
			co.Add (c1);
			co.WrongRemove (c1);
		}