コード例 #1
0
        public void ThreadExitTest()
        {
            thread_exit_count = 0;

            MyForm f1 = new MyForm();

            f1.ShowInTaskbar = false;
            ctx             = new ApplicationContext(f1);
            ctx.ThreadExit += new EventHandler(thread_exit);

            Assert.AreEqual(f1, ctx.MainForm, "1");
            f1.ShowInTaskbar = false;
            f1.Show();
            f1.Dispose();
            Assert.AreEqual(f1, ctx.MainForm, "2");
            Assert.AreEqual(1, thread_exit_count, "3");

            f1               = new MyForm();
            ctx              = new ApplicationContext(f1);
            ctx.ThreadExit  += new EventHandler(thread_exit);
            f1.ShowInTaskbar = false;
            f1.Show();
            f1.DoDestroyHandle();
            Assert.AreEqual(f1, ctx.MainForm, "4");
            Assert.AreEqual(2, thread_exit_count, "5");
            f1.Dispose();
        }
コード例 #2
0
        public void MnemonicCalledWhenCanSelectFalse()
        {
            MyForm f = new MyForm();

            f.ShowInTaskbar = false;

            MyControl c = new MyControl();

            f.Controls.Add(c);
            f.Show();

            Assert.AreEqual(false, c.CanSelect, "A1");
            f.PublicProcessMnemonic('b');

            Assert.AreEqual(true, c.mnemonic_called, "A2");
            f.Dispose();
        }
コード例 #3
0
		public void TestEventOrdering ()
		{
			thread_exit_count = 0;
			reached_form_handle_destroyed = false;

			MyForm f1 = new MyForm ();
			f1.ShowInTaskbar = false;
			f1.HandleDestroyed += new EventHandler (form_handle_destroyed);

			ctx = new ApplicationContext (f1);
			ctx.ThreadExit += new EventHandler (thread_exit);

			f1.Show ();
			f1.DoDestroyHandle ();

			Assert.AreEqual (true, reached_form_handle_destroyed, "3");
			Assert.AreEqual (1, thread_exit_count, "4");

			f1.Dispose ();
		}
コード例 #4
0
        public void TestEventOrdering2()
        {
            thread_exit_count             = 0;
            reached_form_handle_destroyed = false;

            MyForm f1 = new MyForm();

            f1.ShowInTaskbar = false;

            ctx             = new ApplicationContext(f1);
            ctx.ThreadExit += new EventHandler(thread_exit);

            f1.HandleDestroyed += new EventHandler(form_handle_destroyed2);

            f1.Show();
            f1.DoDestroyHandle();
            Assert.AreEqual(true, reached_form_handle_destroyed, "3");
            Assert.AreEqual(1, thread_exit_count, "4");

            f1.Dispose();
        }
コード例 #5
0
		public void ThreadExitTest ()
		{
			thread_exit_count = 0;

			MyForm f1 = new MyForm ();
			f1.ShowInTaskbar = false;
			ctx = new ApplicationContext (f1);
			ctx.ThreadExit += new EventHandler (thread_exit);

			Assert.AreEqual (f1, ctx.MainForm, "1");
			f1.ShowInTaskbar = false;
			f1.Show ();
			f1.Dispose ();
			Assert.AreEqual (f1, ctx.MainForm, "2");
			Assert.AreEqual (1, thread_exit_count, "3");

			f1 = new MyForm ();
			ctx = new ApplicationContext (f1);
			ctx.ThreadExit += new EventHandler (thread_exit);
			f1.ShowInTaskbar = false;
			f1.Show ();
			f1.DoDestroyHandle ();
			Assert.AreEqual (f1, ctx.MainForm, "4");
			Assert.AreEqual (2, thread_exit_count, "5");
			f1.Dispose ();
		}
コード例 #6
0
		public void MnemonicCalledWhenCanSelectFalse ()
		{
			MyForm f = new MyForm ();
			f.ShowInTaskbar = false;
			
			MyControl c = new MyControl ();
			
			f.Controls.Add (c);
			f.Show ();
			
			Assert.AreEqual (false, c.CanSelect, "A1");
			f.PublicProcessMnemonic ('b');
			
			Assert.AreEqual (true, c.mnemonic_called, "A2");
			f.Dispose ();
		}
コード例 #7
0
ファイル: FormTest.cs プロジェクト: KonajuGames/SharpLang
		public void DestroyHandleTest ()
		{
			handle_destroyed_count = 0;

			MyForm f1 = new MyForm ();
			f1.HandleDestroyed += new EventHandler (handle_destroyed);
			f1.Show ();
			f1.DoDestroyHandle ();
			Assert.AreEqual (1, handle_destroyed_count, "1");

			MyForm f2 = new MyForm ();
			f2.HandleDestroyed += new EventHandler (handle_destroyed);
			f2.Show ();
			f2.DoRecreateHandle ();
			Assert.AreEqual (2, handle_destroyed_count, "2");
			
			f1.Dispose ();
			f2.Dispose ();
		}