예제 #1
0
        public void AnalysisWsListAdd()
        {
            // Setup so the order in the Analysis WS list should be: Spanish, English IPA,
            // English and French.
            SetupAnalysisWss();

            // Disable all these buttons so we can verify that they will be enabled after
            // adding a new writing system.
            m_dlg.OkButton.Enabled             = false;
            m_dlg.AnalWsDeleteButton.Enabled   = false;
            m_dlg.AnalWsModifyButton.Enabled   = false;
            m_dlg.AnalWsMoveUpButton.Enabled   = false;
            m_dlg.AnalWsMoveDownButton.Enabled = false;

            // Add a new writing system to the cache.
            int             newWsHvo = m_inMemoryCache.SetupWs("no");
            LgWritingSystem ws       = m_inMemoryCache.CreateWritingSystem(m_inMemoryCache.Cache,
                                                                           newWsHvo, "no", new int[] { (int)InMemoryFdoCache.s_wsHvos.En }, new string[] { "new one" });

            m_dlg.SimulateAnalAddingWs(ws);

            VerifyWritingSystemOrder(m_dlg.AnalWsList,
                                     new string[] { "Spanish", "English IPA", "English", "French", "new one" });

            // Verify that the new writing system is the selected one.
            Assert.AreEqual(ws, (LgWritingSystem)m_dlg.AnalWsList.SelectedItem,
                            "New writing system is not selected.");

            // Verify that the correct items are checked.
            VerifyCheckedWritingSystems(m_dlg.AnalWsList,
                                        new string[] { "Spanish", "English IPA", "new one" }, true);

            // Verify that the correct items are not checked.
            VerifyCheckedWritingSystems(m_dlg.AnalWsList,
                                        new string[] { "English", "French" }, false);

            Assert.IsTrue(m_dlg.OkButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsDeleteButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsModifyButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsMoveUpButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsMoveDownButton.Enabled);
        }
        public void AnalysisWsListAdd()
        {
            // Setup so the order in the Analysis WS list should be: Spanish, English (IPA),
            // English and French.
            SetupAnalysisWss();

            // Disable all these buttons so we can verify that they will be enabled after
            // adding a new writing system.
            m_dlg.OkButton.Enabled             = false;
            m_dlg.AnalWsDeleteButton.Enabled   = false;
            m_dlg.AnalWsModifyButton.Enabled   = false;
            m_dlg.AnalWsMoveUpButton.Enabled   = false;
            m_dlg.AnalWsMoveDownButton.Enabled = false;

            // Add a new writing system to the cache.
            IWritingSystem ws = Cache.ServiceLocator.WritingSystemManager.Set("zh-CN");

            m_dlg.SimulateAnalAddingWs(ws);

            VerifyWritingSystemOrder(m_dlg.AnalWsList,
                                     new[] { "English", "English (Phonetic)", "French", "Spanish", "Chinese (CN)" });

            // Verify that the new writing system is the selected one.
            Assert.AreEqual(ws, m_dlg.AnalWsList.SelectedItem, "New writing system is not selected.");

            // Verify that the correct items are checked.
            VerifyCheckedWritingSystems(m_dlg.AnalWsList,
                                        new[] { "English (Phonetic)", "Chinese (CN)", "English" }, true);

            // Verify that the correct items are not checked.
            VerifyCheckedWritingSystems(m_dlg.AnalWsList,
                                        new[] { "Spanish", "French" }, false);

            Assert.IsTrue(m_dlg.OkButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsDeleteButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsModifyButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsMoveUpButton.Enabled);
            Assert.IsTrue(m_dlg.AnalWsMoveDownButton.Enabled);
        }