~ubuntu-branches/debian/stretch/electrum/stretch

« back to all changes in this revision

Viewing changes to gui/kivy/tools/.buildozer/android/platform/python-for-android/dist/kivy/python-install/lib/python2.7/site-packages/kivy/tests/test_uix_anchorlayout.py

  • Committer: Package Import Robot
  • Author(s): Tristan Seligmann
  • Date: 2016-04-04 03:02:39 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20160404030239-0szgkio8yryjv7c9
Tags: 2.6.3-1
* New upstream release.
  - Drop backported install-wizard-connect.patch.
* Add Suggests: python-zbar and update the installation hint to suggest
  apt-get instead of pip (closes: #819517).
* Bump Standards-Version to 3.9.7 (no changes).
* Update Vcs-* links.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''
 
2
Anchor layout unit test
 
3
=======================
 
4
'''
 
5
 
 
6
from kivy.tests.common import GraphicUnitTest
 
7
 
 
8
 
 
9
class UIXAnchorLayoutTestcase(GraphicUnitTest):
 
10
 
 
11
    def box(self, r, g, b):
 
12
        from kivy.uix.widget import Widget
 
13
        from kivy.graphics import Color, Rectangle
 
14
        wid = Widget(size_hint=(None, None), size=(100, 100))
 
15
        with wid.canvas:
 
16
            Color(r, g, b)
 
17
            r = Rectangle(pos=wid.pos, size=wid.size)
 
18
 
 
19
        def linksp(instance, *largs):
 
20
            r.pos = instance.pos
 
21
            r.size = instance.size
 
22
        wid.bind(pos=linksp, size=linksp)
 
23
        return wid
 
24
 
 
25
    def test_anchorlayout_default(self):
 
26
        from kivy.uix.anchorlayout import AnchorLayout
 
27
        r = self.render
 
28
        b = self.box
 
29
 
 
30
        layout = AnchorLayout()
 
31
        layout.add_widget(b(1, 0, 0))
 
32
        r(layout)
 
33
 
 
34
    def test_anchorlayout_x(self):
 
35
        from kivy.uix.anchorlayout import AnchorLayout
 
36
        r = self.render
 
37
        b = self.box
 
38
 
 
39
        layout = AnchorLayout(anchor_x='left')
 
40
        layout.add_widget(b(1, 0, 0))
 
41
        r(layout)
 
42
 
 
43
        layout = AnchorLayout(anchor_x='center')
 
44
        layout.add_widget(b(1, 0, 0))
 
45
        r(layout)
 
46
 
 
47
        layout = AnchorLayout(anchor_x='right')
 
48
        layout.add_widget(b(1, 0, 0))
 
49
        r(layout)
 
50
 
 
51
    def test_anchorlayout_y(self):
 
52
        from kivy.uix.anchorlayout import AnchorLayout
 
53
        r = self.render
 
54
        b = self.box
 
55
 
 
56
        layout = AnchorLayout(anchor_y='bottom')
 
57
        layout.add_widget(b(1, 0, 0))
 
58
        r(layout)
 
59
 
 
60
        layout = AnchorLayout(anchor_y='center')
 
61
        layout.add_widget(b(1, 0, 0))
 
62
        r(layout)
 
63
 
 
64
        layout = AnchorLayout(anchor_y='top')
 
65
        layout.add_widget(b(1, 0, 0))
 
66
        r(layout)
 
67
 
 
68
    def test_anchor_layout_xy(self):
 
69
        from kivy.uix.anchorlayout import AnchorLayout
 
70
        r = self.render
 
71
        b = self.box
 
72
 
 
73
        layout = AnchorLayout(anchor_y='bottom', anchor_x='left')
 
74
        layout.add_widget(b(1, 0, 0))
 
75
        r(layout)
 
76
 
 
77
        layout = AnchorLayout(anchor_y='top', anchor_x='right')
 
78
        layout.add_widget(b(1, 0, 0))
 
79
        r(layout)
 
80