66696f99d60485e36165f8218b21a108f139c53f
[hooke.git] / test / note.py
1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
2 #
3 # This file is part of Hooke.
4 #
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
8 # later version.
9 #
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
17
18 """
19 >>> from hooke.hooke import Hooke, HookeRunner
20 >>> h = Hooke()
21 >>> r = HookeRunner()
22
23 >>> h = r.run_lines(h, ['new_playlist --output_playlist mylist'])
24 <FilePlaylist mylist>
25 Success
26 <BLANKLINE>
27 >>> h = r.run_lines(h, ['glob_curves_to_playlist test/data/vclamp_picoforce/*']
28 ...     )  # doctest: +ELLIPSIS
29 <Curve 0x06130001>
30 <Curve 0x07200000>
31 <Curve 20071120a_i27_t33.100>
32 <Curve 20071120a_i27_t33.101>
33 ...
34 <Curve 20071120a_i27_t33.199>
35 Success
36 <BLANKLINE>
37 >>> h = r.run_lines(h, ['jump_to_curve 14'])
38 Success
39 <BLANKLINE>
40 >>> h = r.run_lines(h, ['''set_note "Hi there.\\nI'm a note"'''])
41 Success
42 <BLANKLINE>
43 >>> h = r.run_lines(h, ['jump_to_curve 27'])
44 Success
45 <BLANKLINE>
46 >>> h = r.run_lines(h, ['''set_note "I'm another note."'''])
47 Success
48 <BLANKLINE>
49 >>> h = r.run_lines(h, ['note_filter_playlist --output_playlist filtered'])
50 <FilePlaylist filtered>
51 Success
52 <BLANKLINE>
53 >>> h = r.run_lines(h, ['get_playlist'])
54 <FilePlaylist mylist>
55 Success
56 <BLANKLINE>
57 >>> h = r.run_lines(h, ['jump_to_playlist -- -1'])
58 Success
59 <BLANKLINE>
60 >>> h = r.run_lines(h, ['get_playlist'])
61 <FilePlaylist filtered>
62 Success
63 <BLANKLINE>
64 >>> h = r.run_lines(h, ['get_curve'])
65 <Curve 20071120a_i27_t33.112>
66 Success
67 <BLANKLINE>
68 >>> h = r.run_lines(h, ['curve_index'])
69 0
70 Success
71 <BLANKLINE>
72 >>> h = r.run_lines(h, ['jump_to_curve -- -1'])
73 Success
74 <BLANKLINE>
75 >>> h = r.run_lines(h, ['get_curve'])
76 <Curve 20071120a_i27_t33.125>
77 Success
78 <BLANKLINE>
79 >>> h = r.run_lines(h, ['curve_index'])
80 1
81 Success
82 <BLANKLINE>
83 >>> h = r.run_lines(h, ['get_note'])
84 I'm another note.
85 Success
86 <BLANKLINE>
87 >>> h = r.run_lines(h, ['set_note ""'])
88 Success
89 <BLANKLINE>
90 >>> h = r.run_lines(h, ['get_note'])
91 None
92 Success
93 <BLANKLINE>
94 """