示例#1
0
 public void OneLineCommand()
 {
     String oneLineString = "one line\n*end";
     StringReader reader = new StringReader(oneLineString);
     command = new InputCommand(reader);
     Assert.AreEqual(1, command.CleanLines().Count);
     Assert.AreEqual(8, command.SelectionStart());
 }
示例#2
0
 public void OneDirtyLine()
 {
     command = new InputCommand(new StringReader("a|b\n*end"));
     Assert.AreEqual("ab", command.CleanLines()[0]);
     Assert.AreEqual(1, command.SelectionStart());
 }
示例#3
0
 private void SetInput(StringReader reader)
 {
     InputCommand input = new InputCommand(reader);
     form.TextModel.Lines = input.CleanLines();
     form.TextModel.SelectionStart = input.SelectionStart();
     form.PutText(null, (String[]) form.TextModel.Lines.ToArray(typeof(String)), form.TextModel.SelectionStart);
 }
示例#4
0
 public void EmptyCommand()
 {
     command = new InputCommand(new StringReader(""));
     Assert.AreEqual(0, command.CleanLines().Count);
 }
示例#5
0
 private void InterpretCommands(String commands, String filename)
 {
     StringReader reader = new StringReader(commands);
     String command;
     while((command = reader.ReadLine()) != null)
     {
         switch(command)
         {
             case "*enter":
                 form.textBox_KeyDown(this, new KeyEventArgs(Keys.Enter));
                 break;
             case "*display":
                 Console.WriteLine("Display\r\n{0}\r\nEnd", form.TextModel.TestText);
                 break;
             case "*output":
                 CompareOutput(reader, filename);
                 break;
             case "*AltP":
                 ExecuteMenu("&P");
                 break;
             case "*shiftEnter":
                 form.textBox_KeyDown(this, new KeyEventArgs(Keys.Enter | Keys.Shift));
                 break;
             case "*input":
                 SetInput(reader);
                 break;
             case "*altS":
                 ExecuteMenu("&S");
                 break;
             case "*loadfile":
                 LoadFile();
                 break;
             case "*savefile":
                 SaveFile();
                 break;
             case "*altU":
                 ExecuteMenu("&U");
                 break;
         }
     }
 }