Esempio n. 1
0
        public void ApproveAndStayPut_NewWordGloss()
        {
            var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(occurrences[0]);
            // create a new analysis.
            var initialAnalysisTree = m_focusBox.InitialAnalysis;

            m_focusBox.DoDuringUnitOfWork = () =>
                                            WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree.Wordform);
            var undoRedoText = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndStayPut(undoRedoText);

            // expect change to the first occurrence.
            Assert.AreEqual(m_focusBox.NewAnalysisTree.Gloss, occurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);

            // test undo.
            Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
            Cache.ActionHandlerAccessor.Undo();
            Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);
        }
Esempio n. 2
0
        /// <summary>
        /// non-undoable task
        /// </summary>
        private void DoSetupFixture()
        {
            // setup default vernacular ws.
            CoreWritingSystemDefinition wsXkal = Cache.ServiceLocator.WritingSystemManager.Set("qaa-x-kal");

            wsXkal.DefaultFont = new FontDefinition("Times New Roman");
            Cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Add(wsXkal);
            Cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Insert(0, wsXkal);
            var textFactory   = Cache.ServiceLocator.GetInstance <ITextFactory>();
            var stTextFactory = Cache.ServiceLocator.GetInstance <IStTextFactory>();

            m_text0 = textFactory.Create();
            //Cache.LangProject.TextsOC.Add(m_text0);
            m_stText0          = stTextFactory.Create();
            m_text0.ContentsOA = m_stText0;
            m_para0_0          = m_stText0.AddNewTextPara(null);
            m_para0_0.Contents = TsStringUtils.MakeString("Xxxhope xxxthis xxxwill xxxdo. xxxI xxxhope.", wsXkal.Handle);

            InterlinMaster.LoadParagraphAnnotationsAndGenerateEntryGuessesIfNeeded(m_stText0, false);
            // paragraph 0_0 simply has wordforms as analyses
            foreach (var occurence in SegmentServices.GetAnalysisOccurrences(m_para0_0))
            {
                if (occurence.HasWordform)
                {
                    m_analysis_para0_0.Add(new AnalysisTree(occurence.Analysis));
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Returns an AnalysisOccurrence at least close to the given bookmark.
        /// If we can't, we return null. This version reports whether we found an exact match or not.
        /// </summary>
        /// <param name="bookmark"></param>
        /// <param name="fExactMatch"></param>
        /// <returns></returns>
        internal AnalysisOccurrence ConvertBookmarkToAnalysis(IStTextBookmark bookmark, out bool fExactMatch)
        {
            fExactMatch = false;
            if (RootStText == null || RootStText.ParagraphsOS.Count == 0 ||
                bookmark.IndexOfParagraph < 0 || bookmark.BeginCharOffset < 0 || bookmark.IndexOfParagraph >= RootStText.ParagraphsOS.Count)
            {
                return(null);
            }
            var para = RootStText.ParagraphsOS[bookmark.IndexOfParagraph] as IStTxtPara;

            if (para == null)
            {
                return(null);
            }

            var point = SegmentServices.FindNearestAnalysis(para,
                                                            bookmark.BeginCharOffset, bookmark.EndCharOffset, out fExactMatch);

            if (point != null && point.Analysis is IPunctuationForm)
            {
                // Don't want to return punctuation! Wordform or null!
                fExactMatch = false;
                if (point.Index > 0)
                {
                    return(point.PreviousWordform());
                }
                return(point.NextWordform());
            }
            return(point);
        }
Esempio n. 4
0
 public APIController()
 {
     _masterCampaignServices = new MasterCampaignServices();
     _childCampaignServices  = new ChildCampaignServices();
     _tacticCampaignServices = new TacticCampaignServices();
     _businessGroupServices  = new BusinessGroupServices();
     _businessLineServices   = new BusinessLineServices();
     _segmentServices        = new SegmentServices();
     _industryServices       = new IndustryServices();
 }
Esempio n. 5
0
 public MasterCampaignController()
 {
     _industryService        = new IndustryServices();
     _businessgroupService   = new BusinessGroupServices();
     _businesslineService    = new BusinessLineServices();
     _segmentService         = new SegmentServices();
     _geographyService       = new GeographyServices();
     _themeService           = new ThemeServices();
     _masterCampaignServices = new MasterCampaignServices();
     _tacticCampaignServices = new TacticCampaignServices();
 }
Esempio n. 6
0
        public TacticCampaignController()
        {
            _industryService        = new IndustryServices();
            _businessgroupService   = new BusinessGroupServices();
            _businesslineService    = new BusinessLineServices();
            _segmentService         = new SegmentServices();
            _geographyService       = new GeographyServices();
            _themeService           = new ThemeServices();
            _tacticCampaignServices = new TacticCampaignServices();
            _childCampaignServices  = new ChildCampaignServices();
            _masterCampaignServices = new MasterCampaignServices();

            _metricReachServices    = new MetricReachServices();
            _metricResponseServices = new MetricResponseServices();
            _journeyStageServices   = new JourneyStageServices();
            _digitalTouchpoint      = new DigitalTouchpoint();
        }
Esempio n. 7
0
        public void ApproveAndMoveNext_NoChange()
        {
            var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(occurrences[0]);
            var initialAnalysisTree = m_focusBox.InitialAnalysis;
            var undoRedoText        = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndMoveNext(undoRedoText);

            // expect no change to the first occurrence.
            Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
            // expect the focus box to be on the next occurrence.
            Assert.AreEqual(occurrences[1], m_focusBox.SelectedOccurrence);

            // nothing to undo.
            Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
        }
Esempio n. 8
0
        public void ApproveAndStayPut_NoChange()
        {
            var ocurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();

            m_interlinDoc.SelectOccurrence(ocurrences[0]);
            var initialAnalysisObj = m_focusBox.InitialAnalysis.Analysis;

            // approve same wordform. Should not result in change during approve.
            m_focusBox.NewAnalysisTree.Analysis = ocurrences[0].Analysis;
            var undoRedoText = new MockUndoRedoText("Undo", "Redo");

            m_focusBox.ApproveAndStayPut(undoRedoText);

            // expect no change to the first occurrence.
            Assert.AreEqual(initialAnalysisObj, ocurrences[0].Analysis);
            // expect the focus box to still be on the first occurrence.
            Assert.AreEqual(ocurrences[0], m_focusBox.SelectedOccurrence);

            // nothing to undo.
            Assert.AreEqual(0, Cache.ActionHandlerAccessor.UndoableSequenceCount);
        }
Esempio n. 9
0
 // Get the segments of the paragraph, making sure they are real and have at least empty (but real)
 // FF annotations.
 private void GetMainParaSegments()
 {
     m_segments = SegmentServices.GetMainParaSegments(m_para);
 }