Exemplo n.º 1
0
        public void FwNewLangProjectModel_CanGoNext()
        {
            var model = new FwNewLangProjectModel();

            model.LoadProjectNameSetup  = () => { };
            model.LoadVernacularSetup   = () => { };
            model.LoadAnalysisSetup     = () => { };
            model.LoadAdvancedWsSetup   = () => { };
            model.LoadAnthropologySetup = () => { };
            model.ProjectName           = DbName;
            var fakeTestWs = new CoreWritingSystemDefinition("fr");

            model.WritingSystemContainer.CurrentVernacularWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.VernacularWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.CurrentAnalysisWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.AnalysisWritingSystems.Add(fakeTestWs);
            Assert.True(model.CanGoNext());
            model.Next();
            Assert.True(model.CanGoNext());
            model.Next();
            Assert.True(model.CanGoNext());
            model.Next();
            Assert.True(model.CanGoNext());
            model.Next();
            Assert.False(model.CanGoNext());
        }
Exemplo n.º 2
0
        public void FwNewLangProjectModel_VernacularAndAnalysisSame_WarningIssued()
        {
            bool warningIssued = false;
            var  model         = new FwNewLangProjectModel();

            model.LoadProjectNameSetup = () => { };
            model.LoadVernacularSetup  = () => { };
            model.LoadAnalysisSetup    = () => { };
            model.LoadAnalysisSameAsVernacularWarning = () => { warningIssued = true; };
            model.ProjectName = DbName;
            var fakeTestWs = new CoreWritingSystemDefinition("fr");

            model.WritingSystemContainer.CurrentVernacularWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.VernacularWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.CurrentAnalysisWritingSystems.Add(fakeTestWs);
            model.WritingSystemContainer.AnalysisWritingSystems.Add(fakeTestWs);
            Assert.True(model.CanGoNext());
            model.Next();             // Move to choose default vernacular
            Assert.True(model.CanGoNext());
            model.Next();             // Move to choose default analysis
            model.SetDefaultWs(new LanguageInfo()
            {
                LanguageTag = "fr"
            });
            Assert.True(warningIssued, "Warning for analysis same as vernacular not triggered");
            Assert.True(model.CanGoNext());             // The user can ignore the warning
        }
Exemplo n.º 3
0
 private void Bind(FwNewLangProjectModel model)
 {
     BindWizardStepControls(model);
     _previous.Enabled = model.CanGoBack();
     _next.Enabled     = model.CanGoNext();
     btnOK.Enabled     = model.CanFinish();
 }
Exemplo n.º 4
0
 private void LoadProjectNameSetup()
 {
     SuspendLayout();
     // Load the project name control if it isn't already.
     // If it is already loaded then leave the content alone to avoid UX problems
     if (_mainContentPanel.Controls.Count == 0 || !(_mainContentPanel.Controls[0] is FwNewProjectProjectNameControl))
     {
         _mainContentPanel.Controls.Clear();
         var projectName = new FwNewProjectProjectNameControl(m_model);
         _mainContentPanel.Controls.Add(projectName);
     }
     else
     {
         ((FwNewProjectProjectNameControl)_mainContentPanel.Controls[0]).Bind(m_model);
     }
     Bind(m_model);
     _next.Enabled = m_model.CanGoNext();
     ResumeLayout();
 }