public void カード分割機能に対応させる() { using (var test = new EPuzzleTestManager()) { test.AddFile(@"mondai\MondaiDocument.xml", TestResources.Mondai03); test.AddFile(@"help\HelpDocument.xml", TestResources.HelpDocumentXml); test.Initialize(); var window = test.Window; var ankimon = (Ankimon)window.EPuzzleData.CurrentMondaiDocument.GetItem("3-3-4"); var ankimonState = new AnkimonState(window, ankimon); window.State = ankimonState; var ankimonRowContainer = ankimonState.GetAllItems().OfType<AnkimonRowContainer>().Single(); var wordCards = ankimonRowContainer.GetAllItems().OfType<WordCard>().ToArray(); ankimonRowContainer.WordCardContainer.Items.Clear(); Assert.False(ankimonState.正解判定()); ankimonRowContainer.WordCardContainer.Items.Add(wordCards.Single(x => x.Text == "Jan")); ankimonRowContainer.WordCardContainer.Items.Add(wordCards.Single(x => x.Text == "u")); ankimonRowContainer.WordCardContainer.Items.Add(wordCards.Single(x => x.Text == "ar")); ankimonRowContainer.WordCardContainer.Items.Add(wordCards.Single(x => x.Text == "y")); Assert.True(ankimonState.正解判定()); } }
public void Test1() { MondaiDocument doc = null; using (var tempFile = new TempFile(TestResources.Mondai03)) { doc = MondaiDocument.Load(tempFile.FileName); } var window = new EPuzzleWindow(); var ankimon = (Ankimon)doc.GetAllItems().First(x => "3-3-1" == x.Id); CollectionAssert.AreEqual(new [] { new MondaiWord("swim"), new MondaiWord("swam"), new MondaiWord("swum"), new MondaiWord("run"), new MondaiWord("ran"), new MondaiWord("run") }, ankimon.GetMondaiWords()); var ankimonState = new AnkimonState(window, ankimon); Assert.AreSame(ankimon, ankimonState.Ankimon); var ankimonBox = ankimonState.GetAllItems().OfType<AnkimonBox>().Single(); Assert.AreEqual(2, ankimonBox.Items.Count()); CollectionAssert.AllItemsAreInstancesOfType(ankimonBox.Items, typeof(AnkimonRowContainer)); var ankimonRowContainer0 = (AnkimonRowContainer)ankimonBox.Items[0]; var ankimonRowContainer1 = (AnkimonRowContainer)ankimonBox.Items[1]; Assert.AreEqual(3, ankimonRowContainer0.WordCardContainer.Items.Count()); Assert.AreEqual(3, ankimonRowContainer1.WordCardContainer.Items.Count()); CollectionAssert.AreEquivalent ( new [] { "swim", "swam", "swum", "run", "ran", "run" }, ankimonBox.GetAllItems().Where(x => x is WordCard).Select(x => x.Text).ToArray() ); Assert.AreEqual(100, ankimonBox.BorderLeft); Assert.AreEqual(100, ankimonBox.BorderTop); // AnkimonRowContainer Assert.AreEqual(DrawingObjectPosition.Relative, ankimonRowContainer0.Position); Assert.AreEqual(110, ankimonRowContainer0.BorderLeft); Assert.AreEqual(100, ankimonRowContainer0.BorderTop); // LabelItem var label0 = ankimonRowContainer0.Label; Assert.AreEqual("泳ぐ", label0.Text); Assert.AreEqual(100, label0.Width); Assert.AreEqual(110, label0.BorderLeft); Assert.AreEqual(100, label0.OuterWidth); Assert.AreEqual(210, label0.BorderRight); // wordCard00 var wordCard00 = ankimonRowContainer0.WordCardContainer.Items[0]; var wordCard10 = ankimonRowContainer1.WordCardContainer.Items[0]; Assert.IsInstanceOf<WordCard>(wordCard00); Assert.AreEqual(DrawingObjectPosition.Absolute, wordCard00.Position); Assert.AreEqual(100, wordCard00.OuterTop); Assert.AreEqual(110, ankimonRowContainer1.BorderLeft); // Assert.AreEqual(110 + WordCard.WordCardHeight + 10, wordCard10.BorderTop); // Assert.AreEqual(110 + WordCard.WordCardHeight + 10, ankimonRowContainer1.BorderTop); }