Exemplo n.º 1
0
        public void OnShow()
        {
            var tool = new DelegateEditorTool <string>(() => "");
            var num  = 0;

            tool.onShow += () => num++;

            tool.Show();

            Assert.AreEqual(1, num);
        }
Exemplo n.º 2
0
        public void HideBeforeShow()
        {
            var tool = new DelegateEditorTool <string>(() => "");
            int num  = 0;

            tool.onHide += () => num++;
            tool.Hide();

            Assert.AreEqual(null, tool.target);
            Assert.IsFalse(tool.Active);
            Assert.AreEqual(0, num, "OnHide was called");
        }
Exemplo n.º 3
0
        public void HideTwice()
        {
            var tool = new DelegateEditorTool <string>(() => "");

            tool.Show();

            int num = 0;

            tool.onHide += () => num++;
            tool.Hide();
            tool.Hide();

            Assert.AreEqual(1, num, "OnHide was called twice");
        }
Exemplo n.º 4
0
        public void Show()
        {
            int num1  = 0;
            var tool1 = new DelegateEditorTool <string>(() => "asdfasdf");

            tool1.onShow += () => num1++;

            int num2  = 0;
            var tool2 = new DelegateEditorTool <string>(() => "asdfasdf");

            tool2.onShow += () => num2++;

            var toolbox = new ToolBox()
            {
                tool1,
                tool2
            };

            toolbox.Show();

            Assert.AreEqual(1, num1);
            Assert.AreEqual(1, num2);
        }