コード例 #1
0
ファイル: ListControlTest.cs プロジェクト: pmq20/mono_forked
        public void ClearSelection()
        {
            ListControlPoker p = new ListControlPoker();

            ListItem foo = new ListItem("foo");
            ListItem bar = new ListItem("bar");

            BeginIndexChanged(p);

            p.Items.Add(foo);
            p.Items.Add(bar);
            p.SelectedIndex = 1;

            // sanity for the real test
            Assert.AreEqual(p.Items.Count, 2, "A1");
            Assert.AreEqual(p.SelectedIndex, 1, "A2");
            Assert.AreEqual(p.SelectedItem, bar, "A3");
            Assert.AreEqual(p.SelectedValue, bar.Value, "A4");

            p.ClearSelection();

            Assert.AreEqual(p.SelectedIndex, -1, "A5");
            Assert.AreEqual(p.SelectedItem, null, "A6");
            Assert.AreEqual(p.SelectedValue, String.Empty, "A7");
            Assert.IsFalse(EndIndexChanged(p), "A8");

            // make sure we are still sane
            Assert.AreEqual(p.Items.Count, 2, "A9");
        }
コード例 #2
0
ファイル: ListControlTest.cs プロジェクト: pmq20/mono_forked
        public void SelectedIndex()
        {
            ListControlPoker p = new ListControlPoker();

            p.Items.Add("one");
            p.Items.Add("two");
            p.Items.Add("three");
            p.Items.Add("four");

            p.Items [2].Selected = true;
            p.Items [1].Selected = true;

            Assert.AreEqual(p.SelectedIndex, 1, "A1");

            p.ClearSelection();
            p.Items [3].Selected = true;

            Assert.AreEqual(p.SelectedIndex, 3, "A2");

            p.SelectedIndex = 1;
            Assert.AreEqual(p.SelectedIndex, 1, "A3");
            Assert.IsFalse(p.Items [3].Selected, "A4");
        }
コード例 #3
0
ファイル: ListControlTest.cs プロジェクト: nobled/mono
		public void SelectedIndex ()
		{
			ListControlPoker p = new ListControlPoker ();

			p.Items.Add ("one");
			p.Items.Add ("two");
			p.Items.Add ("three");
			p.Items.Add ("four");

			p.Items [2].Selected = true;
			p.Items [1].Selected = true;

			Assert.AreEqual (p.SelectedIndex, 1, "A1");

			p.ClearSelection ();
			p.Items [3].Selected = true;

			Assert.AreEqual (p.SelectedIndex, 3, "A2");

			p.SelectedIndex = 1;
			Assert.AreEqual (p.SelectedIndex, 1, "A3");
			Assert.IsFalse (p.Items [3].Selected, "A4");
		}
コード例 #4
0
ファイル: ListControlTest.cs プロジェクト: nobled/mono
		public void ClearSelection ()
		{
			ListControlPoker p = new ListControlPoker ();

			ListItem foo = new ListItem ("foo");
			ListItem bar = new ListItem ("bar");

			BeginIndexChanged (p);

			p.Items.Add (foo);
			p.Items.Add (bar);
			p.SelectedIndex = 1;

			// sanity for the real test
			Assert.AreEqual (p.Items.Count, 2, "A1");
			Assert.AreEqual (p.SelectedIndex, 1, "A2");
			Assert.AreEqual (p.SelectedItem, bar, "A3");
			Assert.AreEqual (p.SelectedValue, bar.Value, "A4");
			
			p.ClearSelection ();

			Assert.AreEqual (p.SelectedIndex, -1, "A5");
			Assert.AreEqual (p.SelectedItem, null, "A6");
			Assert.AreEqual (p.SelectedValue, String.Empty, "A7");
			Assert.IsFalse (EndIndexChanged (p), "A8");

			// make sure we are still sane
			Assert.AreEqual (p.Items.Count, 2, "A9");
		}