1# -*- coding: utf-8 -*- 2 3# Copyright (C) 2005 Osmo Salomaa 4# 5# This program is free software: you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation, either version 3 of the License, or 8# (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, see <http://www.gnu.org/licenses/>. 17 18import aeidon 19import gaupol 20import os 21 22from gi.repository import Gtk 23from gaupol.dialogs.test.test_file import _TestFileDialog 24 25 26class TestSaveDialog(_TestFileDialog): 27 28 def run_dialog(self): 29 self.dialog.run() 30 self.dialog.destroy() 31 32 def setup_method(self, method): 33 gaupol.conf.file.directory = os.getcwd() 34 self.dialog = gaupol.SaveDialog(parent=Gtk.Window(), 35 title="test", 36 mode=aeidon.modes.TIME) 37 38 self.dialog.show() 39 40 def test_get_format(self): 41 self.dialog.set_format(aeidon.formats.SUBRIP) 42 value = self.dialog.get_format() 43 assert value == aeidon.formats.SUBRIP 44 45 def test_get_framerate(self): 46 self.dialog.set_framerate(aeidon.framerates.FPS_23_976) 47 value = self.dialog.get_framerate() 48 assert value == aeidon.framerates.FPS_23_976 49 50 def test_get_newline(self): 51 self.dialog.set_newline(aeidon.newlines.UNIX) 52 value = self.dialog.get_newline() 53 assert value == aeidon.newlines.UNIX 54 55 def test__on_response(self): 56 self.dialog.response(Gtk.ResponseType.CANCEL) 57 58 def test_set_format(self): 59 self.dialog.set_format(aeidon.formats.MICRODVD) 60 value = self.dialog.get_format() 61 assert value == aeidon.formats.MICRODVD 62 63 def test_set_framerate(self): 64 self.dialog.set_framerate(aeidon.framerates.FPS_25_000) 65 value = self.dialog.get_framerate() 66 assert value == aeidon.framerates.FPS_25_000 67 68 def test_set_name__name__basename(self): 69 self.dialog.set_name("test") 70 71 def test_set_name__name__path(self): 72 self.dialog.set_name(self.new_subrip_file()) 73 74 def test_set_newline(self): 75 self.dialog.set_newline(aeidon.newlines.WINDOWS) 76 value = self.dialog.get_newline() 77 assert value == aeidon.newlines.WINDOWS 78