Package org.python.pydev.core.docutils

Examples of org.python.pydev.core.docutils.PySelection


    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testAddLine() {
        ps = new PySelection(new Document("line1\nline2\n"), new TextSelection(doc, 0, 0));
        ps.addLine("foo", 0);
        assertEquals("line1\nfoo\nline2\n", ps.getDoc().get());

        ps = new PySelection(new Document("line1\n"), new TextSelection(doc, 0, 0));
        ps.addLine("foo", 0);
        assertEquals("line1\nfoo\n", ps.getDoc().get());

        ps = new PySelection(new Document("line1"), new TextSelection(doc, 0, 0));
        ps.addLine("foo", 0);
        assertEquals("line1\nfoo\n", ps.getDoc().get().replace("\r\n", "\n"));
    }
View Full Code Here


    /**
     * @throws BadLocationException
     *
     */
    public void testGeneral() throws BadLocationException {
        ps = new PySelection(doc, new TextSelection(doc, 0, 0));
        assertEquals("TestLine1", ps.getCursorLineContents());
        assertEquals("", ps.getLineContentsToCursor());
        ps.selectCompleteLine();

        assertEquals("TestLine1", ps.getCursorLineContents());
View Full Code Here

                "    pass                  \n" +
                "import kkk                \n" +
                "\n" +
                "\n";
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(5, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                "import kkk                \n"
                +
                "\n" +
                "\n";
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(2, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                +
                "import www'''             \n" +
                "\n" +
                "\n";
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(2, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                +
                "    '''\n" +
                "\n" +
                "\n";
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(0, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                "'''This is the data that should be set...\n" +
                "'''\n" +
                "\n" +
                "\n";
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(2, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                +
                "from __future__ import xxx\n" +
                "#we want it to appear in this line\n";
        //must be after the last from __future__ import statement
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(5, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                "import xxx\n"
                +
                "#we want it to appear in this line\n";
        //must be after the last from import statement
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(5, selection.getLineAvailableForImport(false));
    }
View Full Code Here

                "from __future__ import xxx\n"
                +
                "#we want it to appear in this line\n";
        //must be after the last from __future__ import statement
        Document document = new Document(strDoc);
        PySelection selection = new PySelection(document);
        assertEquals(7, selection.getLineAvailableForImport(false));
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.core.docutils.PySelection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.