Ajout du GUI
This commit is contained in:
BIN
kivy/tests/test_issues/__pycache__/test_6315.cpython-310.pyc
Normal file
BIN
kivy/tests/test_issues/__pycache__/test_6315.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
55
kivy/tests/test_issues/test_6315.py
Normal file
55
kivy/tests/test_issues/test_6315.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class PaddingSpacingTestCase(unittest.TestCase):
|
||||
def test_tb_lr_stacklayout(self):
|
||||
from kivy.uix.checkbox import CheckBox
|
||||
a = CheckBox(allow_no_selection=False, group='check')
|
||||
b = CheckBox(allow_no_selection=False, group='check')
|
||||
|
||||
a.active = True
|
||||
self.assertTrue(a.active)
|
||||
self.assertEqual(a.state, 'down')
|
||||
|
||||
self.assertFalse(b.active)
|
||||
self.assertEqual(b.state, 'normal')
|
||||
|
||||
b.active = True
|
||||
self.assertTrue(b.active)
|
||||
self.assertEqual(b.state, 'down')
|
||||
|
||||
self.assertFalse(a.active)
|
||||
self.assertEqual(a.state, 'normal')
|
||||
|
||||
a.state = 'down'
|
||||
self.assertTrue(a.active)
|
||||
self.assertEqual(a.state, 'down')
|
||||
|
||||
self.assertFalse(b.active)
|
||||
self.assertEqual(b.state, 'normal')
|
||||
|
||||
b.state = 'down'
|
||||
self.assertTrue(b.active)
|
||||
self.assertEqual(b.state, 'down')
|
||||
|
||||
self.assertFalse(a.active)
|
||||
self.assertEqual(a.state, 'normal')
|
||||
|
||||
b.state = 'normal'
|
||||
self.assertFalse(a.active)
|
||||
self.assertEqual(a.state, 'normal')
|
||||
self.assertFalse(b.active)
|
||||
self.assertEqual(b.state, 'normal')
|
||||
|
||||
b.state = 'down'
|
||||
self.assertTrue(b.active)
|
||||
self.assertEqual(b.state, 'down')
|
||||
|
||||
self.assertFalse(a.active)
|
||||
self.assertEqual(a.state, 'normal')
|
||||
|
||||
b.active = False
|
||||
self.assertFalse(a.active)
|
||||
self.assertEqual(a.state, 'normal')
|
||||
self.assertFalse(b.active)
|
||||
self.assertEqual(b.state, 'normal')
|
||||
47
kivy/tests/test_issues/test_issue_1084.py
Normal file
47
kivy/tests/test_issues/test_issue_1084.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Bug fixed:
|
||||
# - put utf-8 in string, and validate -> no more crash due to str() encoding
|
||||
# - put utf-8 in string, validate, close, open the app and edit the value -> no
|
||||
# more weird space due to ascii->utf8 encoding.
|
||||
# - create an unicode directory, and select it with Path. -> no more crash at
|
||||
# validation.
|
||||
# - create an unicode directory, and select it with Path and restart -> the
|
||||
# path is still correct.
|
||||
|
||||
from kivy.app import App
|
||||
|
||||
data = '''
|
||||
[
|
||||
{
|
||||
"type": "string",
|
||||
"title": "String",
|
||||
"desc": "-",
|
||||
"section": "test",
|
||||
"key": "string"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"title": "Path",
|
||||
"desc": "-",
|
||||
"section": "test",
|
||||
"key": "path"
|
||||
}
|
||||
]
|
||||
'''
|
||||
|
||||
|
||||
class UnicodeIssueSetting(App):
|
||||
def build_config(self, config):
|
||||
config.add_section('test')
|
||||
config.setdefault('test', 'string', 'Hello world')
|
||||
config.setdefault('test', 'path', '/')
|
||||
|
||||
def build(self):
|
||||
from kivy.uix.settings import Settings
|
||||
s = Settings()
|
||||
s.add_json_panel('Test Panel', self.config, data=data)
|
||||
return s
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
UnicodeIssueSetting().run()
|
||||
19
kivy/tests/test_issues/test_issue_1091.py
Normal file
19
kivy/tests/test_issues/test_issue_1091.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class PaddingSpacingTestCase(unittest.TestCase):
|
||||
def test_tb_lr_stacklayout(self):
|
||||
from kivy.uix.stacklayout import StackLayout
|
||||
from kivy.uix.widget import Widget
|
||||
|
||||
stacklayout = StackLayout(
|
||||
orientation='tb-lr',
|
||||
size=(200, 200),
|
||||
padding=20,
|
||||
spacing=10)
|
||||
|
||||
widget = Widget(width=100, size_hint=(0.2, 0.4))
|
||||
stacklayout.add_widget(widget)
|
||||
stacklayout.do_layout()
|
||||
|
||||
self.assertEqual(stacklayout.top - widget.top, 20)
|
||||
21
kivy/tests/test_issues/test_issue_599.py
Normal file
21
kivy/tests/test_issues/test_issue_599.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class Issue599(unittest.TestCase):
|
||||
|
||||
def test_minmax(self):
|
||||
from kivy.event import EventDispatcher
|
||||
from kivy.properties import BoundedNumericProperty
|
||||
|
||||
class PropertyWidget(EventDispatcher):
|
||||
foo = BoundedNumericProperty(1, min=-5, max=5)
|
||||
|
||||
wid = PropertyWidget()
|
||||
|
||||
self.assertEqual(wid.property('foo').get_min(wid), -5)
|
||||
wid.property('foo').set_min(wid, 0)
|
||||
self.assertEqual(wid.property('foo').get_min(wid), 0)
|
||||
|
||||
self.assertEqual(wid.property('foo').get_max(wid), 5)
|
||||
wid.property('foo').set_max(wid, 10)
|
||||
self.assertEqual(wid.property('foo').get_max(wid), 10)
|
||||
19
kivy/tests/test_issues/test_issue_609.py
Normal file
19
kivy/tests/test_issues/test_issue_609.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from kivy.tests.common import GraphicUnitTest
|
||||
|
||||
|
||||
class Issue609(object):
|
||||
|
||||
def test_markup_pos(self):
|
||||
from kivy.uix.label import Label
|
||||
from kivy.uix.gridlayout import GridLayout
|
||||
|
||||
lbl = Label(text="TextToTest")
|
||||
lbl.bind(text_size=lbl.setter('size'))
|
||||
mrkp = Label(text="TextToTest", markup=True)
|
||||
mrkp.bind(text_size=mrkp.setter('size'))
|
||||
|
||||
grid = GridLayout(rows=1, size_hint=(1, 1))
|
||||
grid.add_widget(lbl)
|
||||
grid.add_widget(mrkp)
|
||||
|
||||
self.render(grid, 2)
|
||||
28
kivy/tests/test_issues/test_issue_6909.py
Normal file
28
kivy/tests/test_issues/test_issue_6909.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import locale
|
||||
import unittest
|
||||
from unittest import mock
|
||||
from kivy import Config
|
||||
from kivy.logger import Logger, FileHandler
|
||||
import pytest
|
||||
|
||||
|
||||
class CodecLoggingTestCase(unittest.TestCase):
|
||||
def test_log_handles_cp949(self):
|
||||
with mock.patch("locale.getpreferredencoding", return_value="cp949"):
|
||||
FileHandler.fd = None
|
||||
FileHandler.encoding = "utf-8"
|
||||
Config.set("kivy", "log_enable", 1)
|
||||
Config.set("kivy", "log_level", "trace")
|
||||
for string in ["한국어", "Niñas and niños"]:
|
||||
Logger.trace("Lang: call_fn => value=%r" % (string,))
|
||||
|
||||
def test_non_utf8_encoding_raises_exception(
|
||||
self,
|
||||
): # the old error before utf-8 was standard
|
||||
FileHandler.fd = None
|
||||
FileHandler.encoding = "cp949"
|
||||
Config.set("kivy", "log_enable", 1)
|
||||
Config.set("kivy", "log_level", "trace")
|
||||
|
||||
with pytest.raises(UnicodeError):
|
||||
Logger.trace("Lang: call_fn => value=%r" % ("Niñas and niños",))
|
||||
12
kivy/tests/test_issues/test_issue_883.py
Normal file
12
kivy/tests/test_issues/test_issue_883.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import unittest
|
||||
|
||||
|
||||
class LabelEmptyMarkupTestCase(unittest.TestCase):
|
||||
def test_empty_markup(self):
|
||||
from kivy.uix.label import Label
|
||||
|
||||
label = Label(text='[b][/b]', markup=True)
|
||||
label.texture_update()
|
||||
self.assertTrue(label.texture is not None)
|
||||
self.assertEqual(label.texture.width, 1)
|
||||
self.assertEqual(label.texture.height, 1)
|
||||
Reference in New Issue
Block a user