Debian Codegraph @

lib/tests/test_logmodel.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2008 Lukáš Lalinský <[email protected]om>
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # 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
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 from breezy.tests import TestCase, TestCaseWithTransport
20 from PyQt5 import QtCore
21
22 from breezy.plugins.qbrz.lib import tests as qtests
23 from breezy.plugins.qbrz.lib.logmodel import (LogModel, GraphVizLoader)
24 from breezy.plugins.qbrz.lib.loggraphviz import BranchInfo
25 from breezy.plugins.qbrz.lib.util import ThrobberWidget
26
27 from breezy.plugins.qbrz.lib.tests.modeltest import ModelTest
28
29
30 class TestModel(qtests.QTestCase):
31
32 def _test(self, wt):
33 def processEvents():
34 pass
35 throbber = ThrobberWidget(None)
36 log_model = LogModel(processEvents, throbber)
37 modeltest = ModelTest(log_model, None)
38 bi = BranchInfo('', wt, wt.branch)
39 log_model.load((bi,), bi, None, False, GraphVizLoader)
40
41 def test_empty_branch(self):
42 wt = self.make_branch_and_tree('.')
43 self._test(wt)
44
45 # Copied for breezy/tests/test_log.py
46 def _prepare_tree_with_merges(self, with_tags=False):
47 wt = self.make_branch_and_memory_tree('.')
48 wt.lock_write()
49 self.addCleanup(wt.unlock)
50 wt.add('')
51 wt.commit('rev-1', rev_id=b'rev-1', timestamp=1132586655, timezone=36000, committer='Joe Foo <[email protected]>')
52 wt.commit('rev-merged', rev_id=b'rev-2a', timestamp=1132586700, timezone=36000, committer='Joe Foo <[email protected]>')
53 wt.set_parent_ids([b'rev-1', b'rev-2a'])
54 wt.branch.set_last_revision_info(1, b'rev-1')
55 wt.commit('rev-2', rev_id=b'rev-2b', timestamp=1132586800, timezone=36000, committer='Joe Foo <[email protected]>')
56 if with_tags:
57 branch = wt.branch
58 branch.tags.set_tag('v0.2', b'rev-2b')
59 wt.commit('rev-3', rev_id=b'rev-3', imestamp=1132586900, timezone=36000, committer='Jane Foo <[email protected]>')
60 branch.tags.set_tag('v1.0rc1', b'rev-3')
61 branch.tags.set_tag('v1.0', b'rev-3')
62 return wt
63
64 def test_merges(self):
65 wt = self._prepare_tree_with_merges()
66 self._test(wt)