diff options
Diffstat (limited to 'trunk/dimbola/plugins/rotate_plugin_tests.py')
-rw-r--r-- | trunk/dimbola/plugins/rotate_plugin_tests.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/trunk/dimbola/plugins/rotate_plugin_tests.py b/trunk/dimbola/plugins/rotate_plugin_tests.py new file mode 100644 index 0000000..f5d790e --- /dev/null +++ b/trunk/dimbola/plugins/rotate_plugin_tests.py @@ -0,0 +1,53 @@ +# Copyright (C) 2009 Lars Wirzenius <liw@liw.fi> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +import unittest + +import rotate_plugin + + +class RotatePluginNewAngleTests(unittest.TestCase): + + def setUp(self): + self.plugin = rotate_plugin.RotatePhotos(None) + + def test_rotates_bad_angle_to_zero(self): + self.assertEqual(self.plugin.new_angle(123, 1), 0) + + def test_rotates_zero_left(self): + self.assertEqual(self.plugin.new_angle(0, -1), 90) + + def test_rotates_zero_right(self): + self.assertEqual(self.plugin.new_angle(0, 1), 270) + + def test_rotates_ninety_left(self): + self.assertEqual(self.plugin.new_angle(90, -1), 180) + + def test_rotates_ninety_right(self): + self.assertEqual(self.plugin.new_angle(90, 1), 0) + + def test_rotates_oneeighty_left(self): + self.assertEqual(self.plugin.new_angle(180, -1), 270) + + def test_rotates_oneeighty_right(self): + self.assertEqual(self.plugin.new_angle(180, 1), 90) + + def test_rotates_twoseventy_left(self): + self.assertEqual(self.plugin.new_angle(270, -1), 0) + + def test_rotates_twoseventy_right(self): + self.assertEqual(self.plugin.new_angle(270, 1), 180) + |