Ejemplo n.º 1
0
		public void TestChildControl ()
		{
			Control c1 = new Control();
			ControlPoker c2 = new ControlPoker ();

			c1.Controls.Add (c2);
			c2.DoSetTopLevel ();
		}
Ejemplo n.º 2
0
		public void Test ()
		{
			Panel p = new Panel ();
			ControlPoker c = new ControlPoker();

			p.Controls.Add (c);

			p.Layout += new LayoutEventHandler (ParentLayoutEvent);
			c.Layout += new LayoutEventHandler (ChildLayoutEvent);

			c.DoOnResize ();

			Assert.AreEqual (1, child_event, "1");
			Assert.AreEqual ("Bounds", child_affected_property, "2");

			Assert.AreEqual (0, parent_event, "3");
		}
Ejemplo n.º 3
0
		public void TestControl ()
		{
			ControlPoker c = new ControlPoker ();
			c.Visible = false;
			c.DoSetTopLevel ();
			Assert.IsTrue (c.DoGetTopLevel (), "1");
			Assert.IsFalse (c.Visible, "2");
		}
Ejemplo n.º 4
0
		public void GetNextControlComposite ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ControlPoker a = new ControlPoker ("a");
			ControlPoker b = new ControlPoker ("b");
			ControlPoker c = new ControlPoker ("c");

			form.Controls.Add (a);
			form.Controls.Add (b);
			b.Controls.Add (c);

			form.Show ();

			Assert.AreEqual (form.GetNextControl (a, true), b, "form-1");
			Assert.AreEqual (form.GetNextControl (a, false), null, "form-2");

			form.Dispose ();
		}
Ejemplo n.º 5
0
		public void GetNextControlDuplicateTabIndex ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ControlPoker [] ctrls = new ControlPoker [5];

			for (int i = 0; i < 5; i++) {
				ctrls [i] = new ControlPoker ();
				ctrls [i].TabIndex = i;
				ctrls [i].Text = "ctrl " + i;
			}

			ctrls [3].TabIndex = 2;

			form.Controls.AddRange (ctrls);
			form.Show ();

			Assert.AreEqual (form.GetNextControl (null, true), ctrls [0], "A1");
			Assert.AreEqual (form.GetNextControl (null, false), ctrls [4], "A2");

			Assert.AreEqual (form.GetNextControl (ctrls [0], true), ctrls [1], "A3");
			Assert.AreEqual (form.GetNextControl (ctrls [0], false), null, "A4");

			Assert.AreEqual (form.GetNextControl (ctrls [1], true), ctrls [2], "A5");
			Assert.AreEqual (form.GetNextControl (ctrls [1], false), ctrls [0], "A6");

			Assert.AreEqual (form.GetNextControl (ctrls [2], true), ctrls [3], "A7");
			Assert.AreEqual (form.GetNextControl (ctrls [2], false), ctrls [1], "A8");

			Assert.AreEqual (form.GetNextControl (ctrls [3], true), ctrls [4], "A9");
			Assert.AreEqual (form.GetNextControl (ctrls [3], false), ctrls [2], "A10");

			Assert.AreEqual (form.GetNextControl (ctrls [4], true), null, "A11");
			Assert.AreEqual (form.GetNextControl (ctrls [4], false), ctrls [3], "A12");

			form.Dispose ();
		}
Ejemplo n.º 6
0
		public void GetNextControl2FromForm ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ContainerPoker con_a = new ContainerPoker ("container-a");
			ContainerPoker con_b = new ContainerPoker ("container-b");
			ContainerPoker con_c = new ContainerPoker ("container-c");
			
			TestHelper.RemoveWarning (con_b, con_c);
			
			ControlPoker [] ctrls_a = new ControlPoker [] {
				new ControlPoker ("ctrls-a-0"), new ControlPoker ("ctrls-a-1"), new ControlPoker ("ctrls-a-2")
			};
			ControlPoker ctrl_b = new ControlPoker ("ctrl-b");
			
			con_a.Controls.AddRange (ctrls_a);
			
			form.Controls.Add (con_a);
			form.Controls.Add (ctrl_b);

			form.Show ();

			// top level movement, 
			Assert.AreEqual (form.GetNextControl (null, true), con_a, "null-1");
			Assert.AreEqual (form.GetNextControl (null, false), ctrl_b, "null-2");

			Assert.AreEqual (form.GetNextControl (form, true), con_a, "form-1");
			Assert.AreEqual (form.GetNextControl (form, false), ctrl_b, "form-2");

			Assert.AreEqual (form.GetNextControl (con_a, true), ctrl_b, "con-a-1");
			Assert.AreEqual (form.GetNextControl (con_a, false), null, "con-a-2");

			Assert.AreEqual (form.GetNextControl (ctrl_b, true), null, "ctrl-b-1");
			Assert.AreEqual (form.GetNextControl (ctrl_b, false), con_a, "ctrl-b-2");

			Assert.AreEqual (form.GetNextControl (ctrls_a [0], true), ctrls_a [1], "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [0], false), con_a, "ctrl-a-2");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], true), ctrls_a [2], "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [1], false), ctrls_a [0], "ctrl-a-2");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], true), ctrl_b, "ctrl-a-1");
			Assert.AreEqual (form.GetNextControl (ctrls_a [2], false), ctrls_a [1], "ctrl-a-2");
			form.Dispose();
		}
Ejemplo n.º 7
0
		public void GetNextControlFromContainerC ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			ContainerPoker con_a = new ContainerPoker ("container-a");
			ContainerPoker con_b = new ContainerPoker ("container-b");
			ContainerPoker con_c = new ContainerPoker ("container-c");
			ControlPoker [] ctrls_a = new ControlPoker [] {
				new ControlPoker ("ctrls-a-0"), new ControlPoker ("ctrls-a-1"), new ControlPoker ("ctrls-a-2")
			};
			ControlPoker [] ctrls_b = new ControlPoker [] {
				new ControlPoker ("ctrls-b-0"), new ControlPoker ("ctrls-b-1"), new ControlPoker ("ctrls-b-2")
			};
			ControlPoker [] ctrls_c = new ControlPoker [] {
				new ControlPoker ("ctrls-c-0"), new ControlPoker ("ctrls-c-1"), new ControlPoker ("ctrls-c-2")
			};

			con_a.Controls.AddRange (ctrls_a);
			con_b.Controls.AddRange (ctrls_b);
			con_c.Controls.AddRange (ctrls_c);
			
			form.Controls.Add (con_a);
			form.Controls.Add (con_b);
			form.Controls.Add (con_c);

			form.Show ();

			// top level movement, 
			Assert.AreEqual (con_c.GetNextControl (null, true), ctrls_c [0], "null-1");
			Assert.AreEqual (con_c.GetNextControl (null, false), ctrls_c [2], "null-2");

			Assert.AreEqual (con_c.GetNextControl (form, true), ctrls_c [0], "form-1");
			Assert.AreEqual (con_c.GetNextControl (form, false), ctrls_c [2], "form-2");
			
			Assert.AreEqual (con_c.GetNextControl (con_a, true), ctrls_c [0], "container-1");
			Assert.AreEqual (con_c.GetNextControl (con_a, false), ctrls_c [2], "container-2");
			Assert.AreEqual (con_c.GetNextControl (con_b, true), ctrls_c [0], "container-3");
			Assert.AreEqual (con_c.GetNextControl (con_b, false), ctrls_c [2], "container-4");
			Assert.AreEqual (con_c.GetNextControl (con_c, true), ctrls_c [0], "container-5");
			Assert.AreEqual (con_c.GetNextControl (con_c, false), ctrls_c [2], "container-6");

			Assert.AreEqual (con_c.GetNextControl (ctrls_a [0], true), ctrls_c [0], "ctrls-a-1");
			Assert.AreEqual (con_c.GetNextControl (ctrls_a [0], false), ctrls_c [2], "ctrls-a-2");
			Assert.AreEqual (con_c.GetNextControl (ctrls_a [1], true), ctrls_c [0], "ctrls-a-3");
			Assert.AreEqual (con_c.GetNextControl (ctrls_a [1], false), ctrls_c [2], "ctrls-a-4");
			Assert.AreEqual (con_c.GetNextControl (ctrls_a [2], true), ctrls_c [0], "ctrls-a-5");
			Assert.AreEqual (con_c.GetNextControl (ctrls_a [2], false), ctrls_c [2], "ctrls-a-6");

			Assert.AreEqual (con_c.GetNextControl (ctrls_b [0], true), ctrls_c [0], "ctrls-b-1");
			Assert.AreEqual (con_c.GetNextControl (ctrls_b [0], false), ctrls_c [2], "ctrls-b-2");
			Assert.AreEqual (con_c.GetNextControl (ctrls_b [1], true), ctrls_c [0], "ctrls-b-3");
			Assert.AreEqual (con_c.GetNextControl (ctrls_b [1], false), ctrls_c [2], "ctrls-b-4");
			Assert.AreEqual (con_c.GetNextControl (ctrls_b [2], true), ctrls_c [0], "ctrls-b-5");
			Assert.AreEqual (con_c.GetNextControl (ctrls_b [2], false), ctrls_c [2], "ctrls-b-6");

			Assert.AreEqual (con_c.GetNextControl (ctrls_c [0], true), ctrls_c [1], "ctrls-c-1");
			Assert.AreEqual (con_c.GetNextControl (ctrls_c [0], false), null, "ctrls-c-2");
			Assert.AreEqual (con_c.GetNextControl (ctrls_c [1], true), ctrls_c [2], "ctrls-c-3");
			Assert.AreEqual (con_c.GetNextControl (ctrls_c [1], false), ctrls_c [0], "ctrls-c-4");
			Assert.AreEqual (con_c.GetNextControl (ctrls_c [2], true), null, "ctrls-c-5");
			Assert.AreEqual (con_c.GetNextControl (ctrls_c [2], false), ctrls_c [1], "ctrls-c-6");
			form.Dispose ();
		}