Here are the examples of the csharp api class SIL.FieldWorks.XWorks.MacroListenerTests.GetF4CommandObject() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
0
1. Example
View license[Test] public void DoDisplayMacro_NoMacro_HidesCommand() { var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false); var ml = new MacroListener(); using (var command = GetF4CommandObject()) { ml.DoDisplayMacro(command, props, null); Assert.That(props.Visible, Is.False); // no implementation of F4, hide it altogether. } }
0
2. Example
View license[Test] public void DoDisplayMacro_NoSelection_ShowsDisabledCommand() { var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false); var ml = new MacroListener(); SetupF4Implementation(ml); using (var command = GetF4CommandObject()) { ml.DoDisplayMacro(command, props, null); Assert.That(props.Visible, Is.True); Assert.That(props.Enabled, Is.False); // can't do it without a selection Assert.That(props.Text, Is.EqualTo("F4test")); } }
0
3. Example
View license[Test] public void DoMacro_NormalPathSucceeds() { var ml = MakeMacroListenerWithCache(); SetupF4Implementation(ml); var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create(); m_actionHandler.EndUndoTask(); // running macro wants to make a new one. var sel = GetValidMockSelection(entry); using (var command = GetF4CommandObject()) { ml.DoMacro(command, sel); Assert.That(entry.Restrictions.AnalysisDefaultWritingSystem.Text, Is.EqualTo("test succeeded")); Assert.That(m_actionHandler.GetUndoText(), Is.EqualTo("Undo F4test")); } }
0
4. Example
View license[Test] public void DoDisplayMacro_WithSafeToDo_ResultDependsOnMacro() { var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false); var ml = MakeMacroListenerWithCache(); var macro = SetupF4Implementation(ml); var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create(); var sel = GetValidMockSelection(entry); using (var command = GetF4CommandObject()) { ml.DoDisplayMacro(command, props, sel); Assert.That(props.Visible, Is.True); Assert.That(props.Enabled, Is.True); Assert.That(props.Text, Is.EqualTo("F4test")); props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false); macro.BeEnabled = false; ml.DoDisplayMacro(command, props, sel); Assert.That(props.Visible, Is.True); Assert.That(props.Enabled, Is.False); // can't do it if the macro says no good. Assert.That(props.Text, Is.EqualTo("F4test")); } }