public void DisableCompareBtn() { // Add Revelation, archive it and then remove it. int hvoTitle; Assert.IsNull(ScrBook.FindBookByID(m_cache, 66), "Revelation should not be in the database. Restore the clean version of TestLangProj."); IScrBook revelation = ScrBook.CreateNewScrBook(66, m_scr, out hvoTitle); ITsPropsFactory propFact = TsPropsFactoryClass.Create(); ITsTextProps ttp = propFact.MakeProps(ScrStyleNames.NormalParagraph, m_cache.DefaultVernWs, 0); ScrSection.CreateScrSection(revelation, 0, "Text for section", ttp, false); AddArchive("Revelation Archive", new List <int>(new int[] { revelation.Hvo })); m_scr.ScriptureBooksOS.Remove(m_scr.ScriptureBooksOS[3]); DummySavedVersionsDialog dlg = new DummySavedVersionsDialog(m_cache); TreeView tree = dlg.ArchiveTree; // Select the archive node that was just added. tree.SelectedNode = tree.Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Compare to Current Version button is disabled Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be disabled"); // Select a book node. tree.SelectedNode = tree.Nodes[0].Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Diff button is still disabled if we select Philemon // after it is removed from the DB. Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should still"); }
public void DisableCompareBtn() { // Add Revelation, archive it and then remove it. IStText title; Assert.IsNull(m_scr.FindBook(66), "Revelation should not be in the database. Restore the clean version of TestLangProj."); IScrBook revelation = Cache.ServiceLocator.GetInstance<IScrBookFactory>().Create(66, out title); ITsPropsFactory propFact = TsPropsFactoryClass.Create(); ITsTextProps ttp = propFact.MakeProps(ScrStyleNames.NormalParagraph, Cache.DefaultVernWs, 0); Cache.ServiceLocator.GetInstance<IScrSectionFactory>().CreateScrSection(revelation, 0, "Text for section", ttp, false); AddArchive("Revelation Archive", new List<IScrBook>(new IScrBook[] { revelation })); m_scr.ScriptureBooksOS.Remove(revelation); using (DummySavedVersionsDialog dlg = new DummySavedVersionsDialog(Cache)) { TreeView tree = dlg.ArchiveTree; // Select the archive node that was just added. tree.SelectedNode = tree.Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Compare to Current Version button is disabled Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be disabled"); TreeNode revNode = null; TreeNode phmNode = null; foreach (TreeNode node in tree.Nodes) { if (node.Nodes.Count > 0 && node.Nodes[0].Tag is IScrBook) { if (((IScrBook)node.Nodes[0].Tag).CanonicalNum == 66) revNode = node.Nodes[0]; if (((IScrBook)node.Nodes[0].Tag).CanonicalNum == 57) phmNode = node.Nodes[0]; } } Assert.IsNotNull(revNode, "there should be an archive where the first book is Revelation"); Assert.IsNotNull(phmNode, "there should be an archive where the first book is Philemon"); // Select a book node for Revelation. tree.SelectedNode = revNode; dlg.SimulateSelectEvent(); // Check to make sure the Diff button is still disabled if we select Revelation // after it is removed from the DB. Assert.IsTrue(tree.SelectedNode.Tag is IScrBook); var bookId = ((IScrBook)tree.SelectedNode.Tag).CanonicalNum; Assert.AreEqual(66, bookId); Assert.IsNull(m_scr.FindBook(bookId)); Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should still be disabled."); // However, the diff button should be enabled if we select Philemon in the second archive // since it is in our database. tree.SelectedNode = phmNode; // selecting Philemon dlg.SimulateSelectEvent(); Assert.IsTrue(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be enabled when Philemon is selected."); } }
public void DisableCompareBtn() { // Add Revelation, archive it and then remove it. IStText title; Assert.IsNull(m_scr.FindBook(66), "Revelation should not be in the database. Restore the clean version of TestLangProj."); IScrBook revelation = Cache.ServiceLocator.GetInstance <IScrBookFactory>().Create(66, out title); ITsPropsFactory propFact = TsPropsFactoryClass.Create(); ITsTextProps ttp = propFact.MakeProps(ScrStyleNames.NormalParagraph, Cache.DefaultVernWs, 0); Cache.ServiceLocator.GetInstance <IScrSectionFactory>().CreateScrSection(revelation, 0, "Text for section", ttp, false); AddArchive("Revelation Archive", new List <IScrBook>(new IScrBook[] { revelation })); m_scr.ScriptureBooksOS.Remove(revelation); using (DummySavedVersionsDialog dlg = new DummySavedVersionsDialog(Cache)) { TreeView tree = dlg.ArchiveTree; // Select the archive node that was just added. tree.SelectedNode = tree.Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Compare to Current Version button is disabled Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be disabled"); TreeNode revNode = null; TreeNode phmNode = null; foreach (TreeNode node in tree.Nodes) { if (node.Nodes.Count > 0 && node.Nodes[0].Tag is IScrBook) { if (((IScrBook)node.Nodes[0].Tag).CanonicalNum == 66) { revNode = node.Nodes[0]; } if (((IScrBook)node.Nodes[0].Tag).CanonicalNum == 57) { phmNode = node.Nodes[0]; } } } Assert.IsNotNull(revNode, "there should be an archive where the first book is Revelation"); Assert.IsNotNull(phmNode, "there should be an archive where the first book is Philemon"); // Select a book node for Revelation. tree.SelectedNode = revNode; dlg.SimulateSelectEvent(); // Check to make sure the Diff button is still disabled if we select Revelation // after it is removed from the DB. Assert.IsTrue(tree.SelectedNode.Tag is IScrBook); var bookId = ((IScrBook)tree.SelectedNode.Tag).CanonicalNum; Assert.AreEqual(66, bookId); Assert.IsNull(m_scr.FindBook(bookId)); Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should still be disabled."); // However, the diff button should be enabled if we select Philemon in the second archive // since it is in our database. tree.SelectedNode = phmNode; // selecting Philemon dlg.SimulateSelectEvent(); Assert.IsTrue(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be enabled when Philemon is selected."); } }
public void DisableCompareBtn() { // Add Revelation, archive it and then remove it. int hvoTitle; Assert.IsNull(ScrBook.FindBookByID(m_cache, 66), "Revelation should not be in the database. Restore the clean version of TestLangProj."); IScrBook revelation = ScrBook.CreateNewScrBook(66, m_scr, out hvoTitle); ITsPropsFactory propFact = TsPropsFactoryClass.Create(); ITsTextProps ttp = propFact.MakeProps(ScrStyleNames.NormalParagraph, m_cache.DefaultVernWs, 0); ScrSection.CreateScrSection(revelation, 0, "Text for section", ttp, false); AddArchive("Revelation Archive", new List<int>(new int[] { revelation.Hvo })); m_scr.ScriptureBooksOS.Remove(m_scr.ScriptureBooksOS[3]); DummySavedVersionsDialog dlg = new DummySavedVersionsDialog(m_cache); TreeView tree = dlg.ArchiveTree; // Select the archive node that was just added. tree.SelectedNode = tree.Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Compare to Current Version button is disabled Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be disabled"); // Select a book node. tree.SelectedNode = tree.Nodes[0].Nodes[0]; dlg.SimulateSelectEvent(); // Check to make sure the Diff button is still disabled if we select Philemon // after it is removed from the DB. Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should still"); }