Exemple #1
0
        public void Test_Push_Button()
        {
            var btn = new Button (ButtonType.Push);

            Assert.AreEqual (ButtonState.Normal, btn.State);

            btn.OnMouseButtonPressed (MouseButton.Left, 0, 0);
            Assert.AreEqual (ButtonState.Pressed, btn.State);

            // プッシュ ボタンはリリースすると戻る
            btn.OnMouseButtonReleased (MouseButton.Left, 0, 0);
            Assert.AreEqual (ButtonState.Normal, btn.State);

            btn.OnMouseFocusIn (0, 0);
            Assert.AreEqual (ButtonState.FocusedNormal, btn.State);

            btn.OnMouseFocusOut (0, 0);
            Assert.AreEqual (ButtonState.Normal, btn.State);
        }
Exemple #2
0
        public void Test_Toggle_Button()
        {
            var btn = new Button (ButtonType.Toggle);

            Assert.AreEqual (ButtonState.Normal, btn.State);

            btn.OnMouseButtonPressed (MouseButton.Left, 0, 0);
            Assert.AreEqual (ButtonState.Pressed, btn.State);

            // トグル ボタンはリリースしても押されたまま
            btn.OnMouseButtonReleased (MouseButton.Left, 0, 0);
            Assert.AreEqual (ButtonState.Pressed, btn.State);

            btn.OnMouseButtonPressed (MouseButton.Left, 0, 0);
            Assert.AreEqual (ButtonState.Normal, btn.State);

            btn.OnMouseFocusIn (0, 0);
            Assert.AreEqual (ButtonState.FocusedNormal, btn.State);

            btn.OnMouseFocusOut (0, 0);
            Assert.AreEqual (ButtonState.Normal, btn.State);
        }