The data grid for the Editorial Checks
Inheritance: CheckRenderingControl, IxCoreColleague
        public void ReRunChecksWithNoBooks()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book    = AddBookToMockedScripture(1, "Genesis");
            IScrSection section = AddSectionToMockedBook(book);
            IStTxtPara  para    = AddParaToMockedSectionContent(section,
                                                                ScrStyleNames.NormalParagraph);

            AddRunToMockedPara(para,
                               "some text for an annotation", ScrStyleNames.Normal);

            using (var renderingCtl = new EditorialChecksRenderingsControl(Cache, m_bookFilter, null, null))
            {
                // Add a checking error annotation.
                AddAnnotation(para, 1001001, NoteType.CheckingError);
                // Now delete the book so that there are not any in the project.
                Cache.DomainDataByFlid.DeleteObj(book.Hvo);
                Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
                                "There should not be books for this test.");

                // Now attempt to load the checking error annotations.
                renderingCtl.LoadCheckingErrors();

                var checkingErrors = ReflectionHelper.GetField(renderingCtl, "m_list")
                                     as List <ICheckGridRowObject>;

                // We expect that no annotations would be added to the EditorialRenderingsControl
                // and that we won't crash trying to load checking error annotations.
                Assert.AreEqual(0, checkingErrors.Count,
                                "Since there are no books, the error annotation should not be added to the rendering control");
            }
        }
示例#2
0
        public void ErrorListIsUpdatedWhenBookFilterChanges()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book1    = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
            IScrSection section1 = m_scrInMemoryCache.AddSectionToMockedBook(book1.Hvo);
            StTxtPara   para1    = m_scrInMemoryCache.AddParaToMockedSectionContent(section1.Hvo,
                                                                                    ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            IScrBook    book2    = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus");
            IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book2.Hvo);
            StTxtPara   para2    = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo,
                                                                                    ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            // Add both books to the book filter
            m_bookFilter.UpdateFilter(book1.Hvo, book2.Hvo);

            EditorialChecksRenderingsControl renderingCtl =
                new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

            // Add some checking errors for each book
            m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
            m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
            renderingCtl.LoadCheckingErrors();

            SortableBindingList <CheckingError> checkingErrors =
                ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
                SortableBindingList <CheckingError>;

            Assert.AreEqual(4, checkingErrors.Count);

            m_bookFilter.UpdateFilter(book1.Hvo);             // Should update the error list

            Assert.AreEqual(2, checkingErrors.Count,
                            "The error list should have been updated when the book filter changed");

#if DEBUG
            // For some very strange reason, without this dispose call in debug mode,
            // there is an assertion in the c++ code when nunit is shut down. With the
            // dispose call in release mode there is a different assertion in c++ code
            // (something about calling a pure virtual method) when nunit is shut down.
            // So, it seems we can't win either way unless making this line conditional
            // on the build config. Argh!!!! - DDO: 16-Jul-2008
            renderingCtl.Dispose();
#endif
        }
示例#3
0
        public void ReRunChecksWithNoBooks()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book    = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
            IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);
            StTxtPara   para    = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
                                                                                   ScrStyleNames.NormalParagraph);

            m_scrInMemoryCache.AddRunToMockedPara(para,
                                                  "some text for an annotation", ScrStyleNames.Normal);

            EditorialChecksRenderingsControl renderingCtl =
                new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

            // Add a checking error annotation.
            m_scrInMemoryCache.AddAnnotation(para, 1001001, NoteType.CheckingError);
            // Now delete the book so that there are not any in the project.
            m_inMemoryCache.Cache.DeleteObject(book.Hvo);
            Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
                            "There should not be books for this test.");

            // Now attempt to load the checking error annotations.
            renderingCtl.LoadCheckingErrors();

            List <ICheckGridRowObject> checkingErrors = ReflectionHelper.GetField(
                renderingCtl, "m_list") as List <ICheckGridRowObject>;

            // We expect that no annotations would be added to the EditorialRenderingsControl
            // and that we won't crash trying to load checking error annotations.
            Assert.AreEqual(0, checkingErrors.Count,
                            "Since there are no books, the error annotation should not be added to the rendering control");

#if DEBUG
            // For some very strange reason, without this dispose call in debug mode,
            // there is an assertion in the c++ code when nunit is shut down. With the
            // dispose call in release mode there is a different assertion in c++ code
            // (something about calling a pure virtual method) when nunit is shut down.
            // So, it seems we can't win either way unless making this line conditional
            // on the build config. Argh!!!! - DDO: 16-Jul-2008
            renderingCtl.Dispose();
#endif
        }
        public void ErrorListIsUpdatedWhenBookFilterChanges()
        {
            // We have to add a paragraph that is owned to add a valid annotation, so create
            // a book, section, paragraph.
            IScrBook    book1    = AddBookToMockedScripture(1, "Genesis");
            IScrSection section1 = AddSectionToMockedBook(book1);
            IStTxtPara  para1    = AddParaToMockedSectionContent(section1,
                                                                 ScrStyleNames.NormalParagraph);

            AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            IScrBook    book2    = AddBookToMockedScripture(2, "Exodus");
            IScrSection section2 = AddSectionToMockedBook(book2);
            IStTxtPara  para2    = AddParaToMockedSectionContent(section2,
                                                                 ScrStyleNames.NormalParagraph);

            AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

            // Add both books to the book filter
            m_bookFilter.FilteredBooks = new IScrBook[] { book1, book2 };

            using (var renderingCtl = new EditorialChecksRenderingsControl(Cache, m_bookFilter, null, null))
            {
                // Add some checking errors for each book
                AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
                AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
                AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
                AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
                renderingCtl.LoadCheckingErrors();

                SortableBindingList <CheckingError> checkingErrors =
                    ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
                    SortableBindingList <CheckingError>;

                Assert.AreEqual(4, checkingErrors.Count);

                m_bookFilter.FilteredBooks = new[] { book1 };               // Should update the error list

                Assert.AreEqual(2, checkingErrors.Count,
                                "The error list should have been updated when the book filter changed");
            }
        }
		public void ReRunChecksWithNoBooks()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book = AddBookToMockedScripture(1, "Genesis");
			IScrSection section = AddSectionToMockedBook(book);
			IStTxtPara para = AddParaToMockedSectionContent(section,
				ScrStyleNames.NormalParagraph);

			AddRunToMockedPara(para,
				"some text for an annotation", ScrStyleNames.Normal);

			using (var renderingCtl = new EditorialChecksRenderingsControl(Cache, m_bookFilter, null, null))
			{
				// Add a checking error annotation.
				AddAnnotation(para, 1001001, NoteType.CheckingError);
				// Now delete the book so that there are not any in the project.
				Cache.DomainDataByFlid.DeleteObj(book.Hvo);
				Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
					"There should not be books for this test.");

				// Now attempt to load the checking error annotations.
				renderingCtl.LoadCheckingErrors();

				var checkingErrors = ReflectionHelper.GetField(renderingCtl, "m_list")
					as List<ICheckGridRowObject>;

				// We expect that no annotations would be added to the EditorialRenderingsControl
				// and that we won't crash trying to load checking error annotations.
				Assert.AreEqual(0, checkingErrors.Count,
					"Since there are no books, the error annotation should not be added to the rendering control");
			}
		}
		public void ErrorListIsUpdatedWhenBookFilterChanges()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book1 = AddBookToMockedScripture(1, "Genesis");
			IScrSection section1 = AddSectionToMockedBook(book1);
			IStTxtPara para1 = AddParaToMockedSectionContent(section1,
				ScrStyleNames.NormalParagraph);
			AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			IScrBook book2 = AddBookToMockedScripture(2, "Exodus");
			IScrSection section2 = AddSectionToMockedBook(book2);
			IStTxtPara para2 = AddParaToMockedSectionContent(section2,
				ScrStyleNames.NormalParagraph);
			AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			// Add both books to the book filter
			m_bookFilter.FilteredBooks = new IScrBook[]{book1, book2};

			using (var renderingCtl = new EditorialChecksRenderingsControl(Cache, m_bookFilter, null, null))
			{
				// Add some checking errors for each book
				AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
				AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
				AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
				AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
				renderingCtl.LoadCheckingErrors();

				SortableBindingList<CheckingError> checkingErrors =
					ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
					SortableBindingList<CheckingError>;

				Assert.AreEqual(4, checkingErrors.Count);

				m_bookFilter.FilteredBooks = new[] {book1}; // Should update the error list

				Assert.AreEqual(2, checkingErrors.Count,
					"The error list should have been updated when the book filter changed");
			}
		}
示例#7
0
		public void ReRunChecksWithNoBooks()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);

			m_scrInMemoryCache.AddRunToMockedPara(para,
				"some text for an annotation", ScrStyleNames.Normal);

			EditorialChecksRenderingsControl renderingCtl =
				new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

			// Add a checking error annotation.
			m_scrInMemoryCache.AddAnnotation(para, 1001001, NoteType.CheckingError);
			// Now delete the book so that there are not any in the project.
			m_inMemoryCache.Cache.DeleteObject(book.Hvo);
			Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count,
				"There should not be books for this test.");

			// Now attempt to load the checking error annotations.
			renderingCtl.LoadCheckingErrors();

			List<ICheckGridRowObject> checkingErrors = ReflectionHelper.GetField(
				renderingCtl, "m_list") as List<ICheckGridRowObject>;

			// We expect that no annotations would be added to the EditorialRenderingsControl
			// and that we won't crash trying to load checking error annotations.
			Assert.AreEqual(0, checkingErrors.Count,
				"Since there are no books, the error annotation should not be added to the rendering control");

#if DEBUG
			// For some very strange reason, without this dispose call in debug mode,
			// there is an assertion in the c++ code when nunit is shut down. With the
			// dispose call in release mode there is a different assertion in c++ code
			// (something about calling a pure virtual method) when nunit is shut down.
			// So, it seems we can't win either way unless making this line conditional
			// on the build config. Argh!!!! - DDO: 16-Jul-2008
			renderingCtl.Dispose();
#endif
		}
示例#8
0
		public void ErrorListIsUpdatedWhenBookFilterChanges()
		{
			// We have to add a paragraph that is owned to add a valid annotation, so create
			// a book, section, paragraph.
			IScrBook book1 = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			IScrSection section1 = m_scrInMemoryCache.AddSectionToMockedBook(book1.Hvo);
			StTxtPara para1 = m_scrInMemoryCache.AddParaToMockedSectionContent(section1.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			IScrBook book2 = m_scrInMemoryCache.AddBookToMockedScripture(2, "Exodus");
			IScrSection section2 = m_scrInMemoryCache.AddSectionToMockedBook(book2.Hvo);
			StTxtPara para2 = m_scrInMemoryCache.AddParaToMockedSectionContent(section2.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para1, "some text for an annotation", ScrStyleNames.Normal);

			// Add both books to the book filter
			m_bookFilter.UpdateFilter(book1.Hvo, book2.Hvo);

			EditorialChecksRenderingsControl renderingCtl =
				new EditorialChecksRenderingsControl(Cache, m_bookFilter, null);

			// Add some checking errors for each book
			m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001001), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para1, new BCVRef(1001003), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2002005), NoteType.CheckingError);
			m_scrInMemoryCache.AddAnnotation(para2, new BCVRef(2005005), NoteType.CheckingError);
			renderingCtl.LoadCheckingErrors();

			SortableBindingList<CheckingError> checkingErrors =
				ReflectionHelper.GetField(renderingCtl, "m_checkingErrors") as
				SortableBindingList<CheckingError>;

			Assert.AreEqual(4, checkingErrors.Count);

			m_bookFilter.UpdateFilter(book1.Hvo); // Should update the error list

			Assert.AreEqual(2, checkingErrors.Count,
				"The error list should have been updated when the book filter changed");

#if DEBUG
			// For some very strange reason, without this dispose call in debug mode,
			// there is an assertion in the c++ code when nunit is shut down. With the
			// dispose call in release mode there is a different assertion in c++ code
			// (something about calling a pure virtual method) when nunit is shut down.
			// So, it seems we can't win either way unless making this line conditional
			// on the build config. Argh!!!! - DDO: 16-Jul-2008
			renderingCtl.Dispose();
#endif
		}