This repository has been archived on 2024-12-22. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-22/mockenv/lib/python3.6/site-packages/kivy/tests/test_clipboard.py

43 lines
1.2 KiB
Python
Raw Normal View History

2022-07-22 12:43:59 +02:00
from kivy.tests.common import GraphicUnitTest
class ClipboardTestCase(GraphicUnitTest):
def setUp(self):
from kivy.core.clipboard import Clipboard
self._clippy = Clipboard
clippy_types = Clipboard.get_types()
cliptype = clippy_types[0]
if 'UTF8_STRING' in clippy_types:
cliptype = 'UTF8_STRING'
self._cliptype = cliptype
super(ClipboardTestCase, self).setUp()
def test_clipboard_not_dummy(self):
clippy = self._clippy
if clippy.__class__.__name__ == 'ClipboardDummy':
self.fail('Something went wrong "dummy" clipboard is being used')
def test_clipboard_paste(self):
clippy = self._clippy
try:
clippy.paste()
except:
self.fail(
'Can not get data from clipboard')
def test_clipboard_copy(self):
clippy = self._clippy
try:
clippy.copy(u"Hello World")
except:
self.fail(
'Can not get put data to clipboard')
def test_clipboard_copy_paste(self):
clippy = self._clippy
txt1 = u"Hello 1"
clippy.copy(txt1)
ret = clippy.paste()
self.assertEqual(txt1, ret)