Ejemplo n.º 1
0
            public WritingSystemTreeModel CreateModel()
            {
                var model = new WritingSystemTreeModel(MockSetupModel.Object);

                model.Suggestor = new WritingSystemSuggestor
                {
                    SuggestIpa               = false,
                    SuggestOther             = false,
                    SuggestDialects          = false,
                    SuggestVoice             = false,
                    OtherKnownWritingSystems = null
                };
                return(model);
            }
Ejemplo n.º 2
0
        public void BindToModel(WritingSystemSetupModel model)
        {
            _model = model;
            _model.MethodToShowUiToBootstrapNewDefinition = ShowCreateNewWritingSystemDialog;

            _buttonBar.BindToModel(_model);
            _propertiesTabControl.BindToModel(_model);

            var treeModel = new WritingSystemTreeModel(_model);

            treeModel.Suggestor = model.WritingSystemSuggestor;
            _treeView.BindToModel(treeModel);
            _model.SelectionChanged   += UpdateHeaders;
            _model.CurrentItemUpdated += UpdateHeaders;
            _model.AskUserWhatToDoWithDataInWritingSystemToBeDeleted += OnAskUserWhatToDoWithDataInWritingSystemToBeDeleted;
            UpdateHeaders(null, null);
        }
Ejemplo n.º 3
0
        private static void AssertTreeNodeLabels(WritingSystemTreeModel model, params string[] names)
        {
            var items      = model.GetTreeItems().ToArray();
            int childIndex = 0;

            for (int i = 0, x = -1; i < names.Count(); i++)
            {
                string itemText;
                if (!string.IsNullOrEmpty(names[i]) && names[i].Substring(0, 1) == "+")
                {
                    var child = items[x].Children[childIndex];
                    itemText = "+" + child.Text;
                    ++childIndex;
                }
                else
                {
                    //if we aren't looking at a child node, move to the next top level node
                    ++x;
                    itemText   = items[x].Text;
                    childIndex = 0;
                }
                if (names[i] != itemText)
                {
                    PrintExpectationsVsActual(names, items);
                }
                Assert.AreEqual(names[i], itemText);
                int total = 0;
                foreach (var item in items)
                {
                    ++total;
                    total += item.Children.Count();
                }
                if (names.Count() != total)
                {
                    PrintExpectationsVsActual(names, items);
                }
                Assert.AreEqual(names.Count(), total, "the actual nodes exceded the number of expected ones");
            }
        }