コード例 #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);
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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('.');
        }
コード例 #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);
        }
コード例 #6
0
 public void Init()
 {
     textEditor = new MockTextEditor();
     console    = new PythonConsole(textEditor, null);
     console.Write(prompt, Style.Prompt);
 }
コード例 #7
0
 public void SetUpFixture()
 {
     textEditor = new MockTextEditor();
     stream     = new PythonOutputStream(textEditor);
 }
コード例 #8
0
 public void Init()
 {
     mockTextEditor      = new MockTextEditor();
     mockTextEditor.Text = String.Empty;
     pythonConsole       = new PythonConsole(mockTextEditor, null);
 }
コード例 #9
0
 public void Init()
 {
     textEditor    = new MockTextEditor();
     pythonConsole = new PythonConsole(textEditor, null);
 }