File: test_window_caption.py

package info (click to toggle)
pyglet 1.5.27%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,356 kB
  • sloc: python: 98,028; ansic: 171; makefile: 148; sh: 9
file content (26 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
import pyglet


window_captions = [u'ใƒ†ใ‚นใƒˆ.py', u'\u00bfHabla espa\u00f1ol?', 'test']


def test_window_caption():
    """Test that the Window caption is correctly set on instantiation. """
    for test_caption in window_captions:
        window = pyglet.window.Window(caption=test_caption)
        assert window.caption == test_caption
        window.close()


def test_window_caption_from_argv():
    """Test that the window caption is set from sys.argv[0], if none is explicity set. """
    for test_caption in window_captions:

        # Override sys.argv[0] so that the file name appears to be the caption:
        sys.argv[0] = test_caption

        # The window caption should be set to the file name:
        window = pyglet.window.Window()
        assert window.caption == test_caption
        window.close()