Beispiel #1
0
        public void Init()
        {
            mockTextEditor = new MockTextEditor();
            pythonConsole  = new PythonConsole(mockTextEditor, null);

            autoIndentSize = initialAutoIndentSize;
            Thread thread = new Thread(ReadLineFromConsoleOnDifferentThread);

            thread.Start();

            int sleepInterval = 10;
            int maxWait       = 2000;
            int currentWait   = 0;

            while (mockTextEditor.Text.Length < autoIndentSize && currentWait < maxWait)
            {
                Thread.Sleep(sleepInterval);
                currentWait += sleepInterval;
            }

            raiseKeyPressEvent       = mockTextEditor.RaiseKeyPressEvent('a');
            raiseDialogKeyPressEvent = mockTextEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            currentWait = 0;
            while (mockTextEditor.Text.Length < autoIndentSize + 2 && currentWait < maxWait)
            {
                Thread.Sleep(10);
                currentWait += sleepInterval;
            }
            thread.Join(2000);
        }
        public void SetUpFixture()
        {
            MockTextEditor textEditor = new MockTextEditor();

            using (pythonConsole = new PythonConsole(textEditor, null)) {
                textEditor.RaiseKeyPressEvent('a');
                textEditor.RaiseKeyPressEvent('=');
                textEditor.RaiseKeyPressEvent('1');
                lineAvailableBeforeFirstEnterKey = pythonConsole.IsLineAvailable;
                textEditor.RaiseDialogKeyPressEvent(Keys.Enter);
                lineAvailableAfterFirstEnterKey = pythonConsole.IsLineAvailable;

                textEditor.RaiseKeyPressEvent('b');
                textEditor.RaiseKeyPressEvent('=');
                textEditor.RaiseKeyPressEvent('2');
                textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

                Thread t = new Thread(ReadLinesOnSeparateThread);
                t.Start();

                int sleepInterval = 20;
                int currentWait   = 0;
                int maxWait       = 2000;

                while (line2 == null && currentWait < maxWait)
                {
                    Thread.Sleep(sleepInterval);
                    currentWait += sleepInterval;
                }

                lineAvailableAtEnd = pythonConsole.IsLineAvailable;
            }
        }
        public void SetUpFixture()
        {
            textEditor = new MockTextEditor();
            console    = new PythonConsole(textEditor, null);
            console.WriteLine(prompt, Style.Prompt);

            textEditor.RaiseKeyPressEvents("__builtins__");
            showCompletionWindowCalledBeforeDotTypedIn = textEditor.IsShowCompletionWindowCalled;
            textEditor.RaiseKeyPressEvent('.');
        }
        public void Init()
        {
            textEditor    = new MockTextEditor();
            pythonConsole = new PythonConsole(textEditor, null);
            pythonConsole.Write(prompt, Style.Prompt);

            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);
            pythonConsole.Write(prompt, Style.Prompt);
            textEditor.RaiseKeyPressEvent('b');
            textEditor.RaiseKeyPressEvent('.');
        }
Beispiel #5
0
        public void NoTextWrittenWhenAutoIndentSizeIsZero()
        {
            MockTextEditor textEditor = new MockTextEditor();
            PythonConsole  console    = new PythonConsole(textEditor, null);

            textEditor.RaiseKeyPressEvent('a');
            textEditor.RaiseDialogKeyPressEvent(Keys.Enter);

            textEditor.IsWriteCalled = false;
            console.ReadLine(0);
            Assert.IsFalse(textEditor.IsWriteCalled);
        }
 public void Init()
 {
     textEditor = new MockTextEditor();
     console    = new PythonConsole(textEditor, null);
     console.Write(prompt, Style.Prompt);
 }
 public void SetUpFixture()
 {
     textEditor = new MockTextEditor();
     stream     = new PythonOutputStream(textEditor);
 }
 public void Init()
 {
     mockTextEditor      = new MockTextEditor();
     mockTextEditor.Text = String.Empty;
     pythonConsole       = new PythonConsole(mockTextEditor, null);
 }
 public void Init()
 {
     textEditor    = new MockTextEditor();
     pythonConsole = new PythonConsole(textEditor, null);
 }