示例#1
0
        public void BuildMruList()
        {
            MenuSystem      sys  = new TestMenuSystem(this);
            CommandMenuItem item = new CommandMenuItem("MRU", cmdSet, mruFirst);

            item.IsDynamic = true;
            menu.Add(item);
            sys.SetStatusForMenuItems(menu);
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 2, Item(2).MenuCommand.CommandID.ID);

            sys.SetStatusForMenuItems(menu);                            // Drop the menu again
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst + 2, Item(2).MenuCommand.CommandID.ID);
        }
示例#2
0
        public void BuildMruList()
        {
            MenuSystem sys = new TestMenuSystem(this);
            CommandMenuItem item = new CommandMenuItem("MRU", cmdSet, mruFirst);
            item.IsDynamic = true;
            menu.Add(item);
            sys.SetStatusForMenuItems(menu);
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst+1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst+2, Item(2).MenuCommand.CommandID.ID);

            sys.SetStatusForMenuItems(menu);		// Drop the menu again
            Assert.AreEqual(3, menu.Count);
            Assert.AreEqual("MRU 0", Item(0).Text);
            Assert.AreEqual("MRU 1", Item(1).Text);
            Assert.AreEqual("MRU 2", Item(2).Text);
            Assert.AreEqual(mruFirst, Item(0).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst+1, Item(1).MenuCommand.CommandID.ID);
            Assert.AreEqual(mruFirst+2, Item(2).MenuCommand.CommandID.ID);
        }
示例#3
0
		public void SetStatusForMenuItems()
		{
			CommandMenuItem item = new CommandMenuItem("Test1", cmdSet, 1);
			menu.Add(item);
			item = new CommandMenuItem("Test2", cmdSet, 2);
			menu.Add(item);

			MenuSystem sys = new TestMenuSystem(this);
			mpCmdIdToStatus[1] = (MenuStatus.Visible|MenuStatus.Enabled);
			mpCmdIdToStatus[2] = (MenuStatus.Visible);
			sys.SetStatusForMenuItems(menu);
			Assert.AreEqual("Test1", Item(0).Text);
			Assert.AreEqual(1, Item(0).MenuCommand.CommandID.ID);
			Assert.IsTrue(Item(0).Visible);
			Assert.IsTrue(Item(0).Enabled);

			Assert.AreEqual("Test2", Item(1).Text);
			Assert.IsTrue(Item(1).Visible);
			Assert.IsFalse(Item(1).Enabled);
		}
示例#4
0
        public void SetStatusForMenuItems()
        {
            CommandMenuItem item = new CommandMenuItem("Test1", cmdSet, 1);

            menu.Add(item);
            item = new CommandMenuItem("Test2", cmdSet, 2);
            menu.Add(item);

            MenuSystem sys = new TestMenuSystem(this);

            mpCmdIdToStatus[1] = (MenuStatus.Visible | MenuStatus.Enabled);
            mpCmdIdToStatus[2] = (MenuStatus.Visible);
            sys.SetStatusForMenuItems(menu);
            Assert.AreEqual("Test1", Item(0).Text);
            Assert.AreEqual(1, Item(0).MenuCommand.CommandID.ID);
            Assert.IsTrue(Item(0).Visible);
            Assert.IsTrue(Item(0).Enabled);

            Assert.AreEqual("Test2", Item(1).Text);
            Assert.IsTrue(Item(1).Visible);
            Assert.IsFalse(Item(1).Enabled);
        }