Ejemplo n.º 1
0
        public void VerifyAllStylesInCombo()
        {
            // Initialize the combo box.
            m_styleListHelper.AddStyles(m_styleSheet);

            // Get the count of styles in the DB.
            int styleCountExpected = m_lp.StylesOC.Count;

            // Verify that all the styles that are in the DB are in the combo box list.
            int i;

            foreach (var style in m_lp.StylesOC)
            {
                if (style.Context == ContextValues.Internal)
                {
                    styleCountExpected--;
                    continue;                     // skip internal styles which won't be in menu.
                }
                i = m_stylesComboBox.FindStringExact(style.Name);
                Assert.IsTrue(i > -1);
                StyleListItem comboItem = (StyleListItem)m_stylesComboBox.Items[i];
                Assert.AreEqual(style.Type, comboItem.Type);
                Assert.IsFalse(comboItem.IsDefaultParaCharsStyle,
                               "Style is Default Paragraph Characters, but should not be");
            }

            // Now check for the Default Paragraph Characters psuedo-style style.
            i = m_stylesComboBox.FindStringExact(StyleUtils.DefaultParaCharsStyleName);
            Assert.IsTrue(i > -1);
            styleCountExpected++;             // Add one for this psuedo-style
            Assert.AreEqual(StyleType.kstCharacter,
                            ((StyleListItem)m_stylesComboBox.Items[i]).Type);
            Assert.IsTrue(((StyleListItem)m_stylesComboBox.Items[i]).IsDefaultParaCharsStyle,
                          "Style is not Default Paragraph Characters, but should be");

            Assert.AreEqual(styleCountExpected, m_stylesComboBox.Items.Count);
        }
Ejemplo n.º 2
0
        public void VerifyStylesSetToInUseInCombo()
        {
            CheckDisposed();

            // Set the combobox to show only character styles
            m_styleListHelper.ShowOnlyStylesOfType = StyleType.kstCharacter;
            m_styleListHelper.MaxStyleLevel        = 5;      // show all styles

            // Initialize the combo box.
            m_styleListHelper.AddStyles(m_styleSheet);
            m_styleListHelper.MaxStyleLevel = 1;
            Assert.IsTrue(m_stylesComboBox.Items.Count > 0, "Oops! Everything got excluded.");

            // Trying to select the style should cause it to be set to "InUse" and it should be
            // added to the list.
            m_styleListHelper.SelectedStyleName = kStyleName;
            StyleListItem item = m_styleListHelper.SelectedStyle;

            // Assume if we have a style item the item was in the list
            Assert.IsNotNull(item);
            Assert.AreEqual(kStyleName, item.Name);
            Assert.IsTrue(item.StyleInfo.RealStyle.InUse);
            Assert.AreEqual(-2, item.UserLevel);
            Assert.AreEqual(-2, item.StyleInfo.UserLevel);
        }