File: test_pattern.py

package info (click to toggle)
gimp 3.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 210,076 kB
  • sloc: ansic: 842,287; lisp: 10,761; python: 10,318; cpp: 7,238; perl: 4,355; sh: 1,043; xml: 963; yacc: 609; lex: 348; javascript: 150; makefile: 43
file content (42 lines) | stat: -rw-r--r-- 941 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

"""
Python to test GimpPattern class of libgimp API.

See comments about usage and setup in test-resource-class.py
Paste into the Python Console and expect no exceptions.

Setup: "Pine" Pattern is selected.

Testing some class methods is in test_resource_class.py

Class has no setters.
Object is not editable.
Class has no is_editable() method.
"""

"""
Test a known, stock pattern "Pine"
!!! Test numeric literals must change if the pattern is changed.
"""
pattern_pine  = Gimp.context_get_pattern()
assert pattern_pine.get_id() == "Pine"

"""
Test getters
"""
success, width, height, bpp = pattern_pine.get_info()
print( width, height, bpp)
assert success
assert width  == 64
assert height == 56
assert bpp    == 3

success, width, height, bpp, pixels = pattern_pine.get_pixels()
print( len(pixels) )
assert success
assert width  == 64
assert height == 56
assert bpp    == 3
assert len(pixels) == 10752

# Not testing the pixels content