##// END OF EJS Templates
Test _anchor tracking in response to mouseMoveEvent Messages...
Diane Trout -
Show More
@@ -2,7 +2,7 b''
2 import unittest
2 import unittest
3
3
4 # System library imports
4 # System library imports
5 from IPython.external.qt import QtGui
5 from IPython.external.qt import QtCore, QtGui
6
6
7 # Local imports
7 # Local imports
8 from IPython.frontend.qt.console.console_widget import ConsoleWidget
8 from IPython.frontend.qt.console.console_widget import ConsoleWidget
@@ -40,3 +40,23 b' class TestConsoleWidget(unittest.TestCase):'
40 self.assertEqual(expected_outputs[i], selection)
40 self.assertEqual(expected_outputs[i], selection)
41 # clear all the text
41 # clear all the text
42 cursor.insertText('')
42 cursor.insertText('')
43
44 def test_link_handling(self):
45 class event(object):
46 def __init__(self, pos):
47 self._pos = pos
48 def pos(self):
49 return self._pos
50
51 w = ConsoleWidget()
52 cursor = w._get_prompt_cursor()
53 w._insert_html(cursor, '<a href="http://python.org">written in</a>')
54 self.assertEqual(w._anchor, None)
55 # should be over text
56 w.mouseMoveEvent(event(QtCore.QPoint(1,5)))
57 self.assertEqual(w._anchor, "http://python.org")
58 # should still be over text
59 w.mouseMoveEvent(event(QtCore.QPoint(5,5)))
60 # should be somewhere else
61 w.mouseMoveEvent(event(QtCore.QPoint(50,50)))
62 self.assertEqual(w._anchor, None)
General Comments 0
You need to be logged in to leave comments. Login now