~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to tests/test_utils_timeline.py

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2014-04-05 15:28:16 UTC
  • mfrom: (6.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20140405152816-6lijoax4cngiz5j5
Tags: 0.93-3
* debian/control:
  + Depend on python-gi (>= 3.10), older versions do not work
    with pitivi (Closes: #732813).
  + Add missing dependency on gir1.2-clutter-gst-2.0 (Closes: #743692).
  + Add suggests on gir1.2-notify-0.7 and gir1.2-gnomedesktop-3.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
#
 
3
# Copyright (c) 2013, Alex Băluț <alexandru.balut@gmail.com>
 
4
#
 
5
# This program is free software; you can redistribute it and/or
 
6
# modify it under the terms of the GNU Lesser General Public
 
7
# License as published by the Free Software Foundation; either
 
8
# version 2.1 of the License, or (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
# Lesser General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU Lesser General Public
 
16
# License along with this program; if not, write to the
 
17
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 
18
# Boston, MA 02110-1301, USA.
 
19
 
 
20
import mock
 
21
from unittest import TestCase
 
22
 
 
23
from pitivi.utils.timeline import Selected, Selection, SELECT, SELECT_ADD, \
 
24
    UNSELECT
 
25
 
 
26
 
 
27
class TestSelected(TestCase):
 
28
 
 
29
    def testBoolEvaluation(self):
 
30
        selected = Selected()
 
31
        self.assertFalse(selected)
 
32
 
 
33
        selected.selected = True
 
34
        self.assertTrue(selected)
 
35
 
 
36
        selected.selected = False
 
37
        self.assertFalse(selected)
 
38
 
 
39
 
 
40
class TestSelection(TestCase):
 
41
 
 
42
    def testBoolEvaluation(self):
 
43
        clip1 = mock.MagicMock()
 
44
        selection = Selection()
 
45
        self.assertFalse(selection)
 
46
        selection.setSelection([clip1], SELECT)
 
47
        self.assertTrue(selection)
 
48
        selection.setSelection([clip1], SELECT_ADD)
 
49
        self.assertTrue(selection)
 
50
        selection.setSelection([clip1], UNSELECT)
 
51
        self.assertFalse(selection)