コード例 #1
0
        public void GetAllItemsTest()
        {
            var testState = new Fish.eigotest.TestState(null);
            var drawingObjectContainer1 = new DrawingObjectContainer();
            var drawingObjectContainer2 = new DrawingObjectContainer();
            var eigoTestLabelItem = new EigoTestLabelItem();

            drawingObjectContainer2.Items.Add(eigoTestLabelItem);
            drawingObjectContainer1.Items.Add(drawingObjectContainer2);
            testState.Items.Add(drawingObjectContainer1);

            Assert.AreEqual(3, testState.GetAllItems().Count());
        }
コード例 #2
0
        public void Test0()
        {
            using (var test = new EPuzzleTestManager())
            {
                test.AddFile(@"mondai\Mondai3.xml", TestResources.Mondai03);
                test.AddFile(@"mondai\Mondai2.xml", TestResources.Mondai02);
                test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml);
                test.Initialize();
                var window = test.Window;
                var userInfo = window.EPuzzleData.CurrentUserInfo;
                var mondai2 = window.EPuzzleData.MondaiDocuments[0];
                var mondai3 = window.EPuzzleData.MondaiDocuments[1];

                var testState = new Fish.eigotest.TestState(window);
                var button0 = new EigoTestButtonItem()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Left = 10,
                    Top = 10,
                    Width = 40,
                    Height = 40,
                    Text = "↑",
                    Name = "button0",
                    IsVisible = true,
                    IsClickable = true,
                    HelpText = "ボタン0",
                };
                testState.Items.Add(button0);

                var button1 = new EigoTestButtonItem()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Left = 800,
                    Top = 10,
                    Width = 40,
                    Height = 40,
                    Text = "↑",
                    Name = "button1",
                    IsVisible = true,
                    IsClickable = true,
            //					HelpText = "ボタン1",
                };
                testState.Items.Add(button1);
                var helpTextBox = new HelpTextBox()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Left = 100,
                    Top = 100,
                    Width = 400,
                    Height = 40,
                };

            /*				Assert.Throws<InvalidOperationException>(() =>
                {
                    helpTextBox.Text = "";
                });*/

                Assert.False(helpTextBox.IsVisible);
                Assert.False(helpTextBox.IsClickable);
                Assert.AreEqual("", helpTextBox.Text);

                testState.Items.Add(helpTextBox);
                Assert.True(helpTextBox.IsVisible);
                Assert.False(helpTextBox.IsClickable);
                Assert.AreEqual("ボタン0", helpTextBox.Text);

                Assert.AreEqual(2, testState.GetAllItems().OfType<EigoTestButtonItem>().Count());
                Assert.AreEqual(1, testState.GetAllItems().OfType<HelpTextBox>().Count());

                window.State = testState;
                Assert.AreSame(button0, window.State.CurrentItem);
                Assert.True(helpTextBox.IsVisible);
                Assert.False(helpTextBox.IsClickable);
                Assert.AreEqual("ボタン0", helpTextBox.Text);

                window.State.CurrentItem = button1;
                Assert.AreSame(button1, window.State.CurrentItem);
                Assert.False(helpTextBox.IsVisible);
                Assert.False(helpTextBox.IsClickable);
                Assert.AreEqual("", helpTextBox.Text);
            }
        }