def setUpClass(cls): cls.working_directory = os.getcwd() paths, index = populate(["vimiv/testimages/arch_001.jpg"], False, False) cls.settings = parse_config() cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.vimiv.main()
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() cls.vimiv = v_main.Vimiv(cls.settings, "testimages", 0) cls.vimiv.main() cls.lib = cls.vimiv.library
def setUpClass(cls): cls.initial_directory = os.getcwd() os.chdir("vimiv/testimages") cls.settings = parse_config() paths, index = populate(["arch_001.jpg"]) cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.vimiv.main()
def test_format_files(self): """Format files according to a formatstring.""" shutil.copytree("testimages/", "testimages_to_format/") os.chdir("testimages_to_format") settings = parse_config() paths, index = fileactions.populate(["arch_001.jpg"]) vimiv = v_main.Vimiv(settings, paths, index) vimiv.main() vimiv.fileextras.format_files("formatted_") files = [fil for fil in os.listdir() if "formatted_" in fil] files = sorted(files) expected_files = [ "formatted_001.jpg", "formatted_002", "formatted_003.bmp", "formatted_004.svg", "formatted_005.tiff", "formatted_006.png" ] self.assertEqual(files, expected_files) os.chdir("..") shutil.rmtree("testimages_to_format") # Should not work without a path vimiv.paths = [] vimiv.fileextras.format_files("formatted_") err_message = vimiv.statusbar.left_label.get_text() expected_message = "No files in path" self.assertEqual(expected_message, err_message) # Should not work in library vimiv.library.focus(True) vimiv.fileextras.format_files("formatted_") err_message = vimiv.statusbar.left_label.get_text() expected_message = "Format only works on opened image files" self.assertEqual(expected_message, err_message)
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() paths, index = populate(["testimages/arch_001.jpg"]) cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.slideshow = cls.vimiv.slideshow cls.vimiv.main()
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() shutil.copytree("testimages", "testimages_man") paths, index = populate(["testimages_man/arch-logo.png"]) cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.vimiv.main() cls.manipulate = cls.vimiv.manipulate
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() paths, index = populate(["testimages"], False, False) cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.vimiv.main() # Move away from directory cls.vimiv.library.scroll("j")
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() paths, index = populate(["testimages/arch-logo.png"]) cls.vimiv = v_main.Vimiv(cls.settings, paths, index) cls.vimiv.main() cls.thumb = cls.vimiv.thumbnail cls.thumb.size = (128, 128) cls.thumb.max_size = (256, 256) cls.thumb.sizes = [(64, 64), (128, 128), (256, 256)]
def test_format_files_with_exif(self): """Format files according to a formatstring with EXIF data.""" shutil.copytree("testimages/", "testimages_to_format/") os.chdir("testimages_to_format") settings = parse_config() paths, index = fileactions.populate(["arch_001.jpg"]) vimiv = v_main.Vimiv(settings, paths, index) vimiv.main() vimiv.fileextras.format_files("formatted_") files = [fil for fil in os.listdir() if "formatted_" in fil] files = sorted(files) expected_files = [ "formatted_001.jpg", "formatted_002", "formatted_003.bmp", "formatted_004.svg", "formatted_005.tiff", "formatted_006.png" ] self.assertEqual(files, expected_files) # These files have no exif info vimiv.fileextras.format_files("formatted_%y_") err_message = vimiv.statusbar.left_label.get_text() expected_message = "No exif data for %s available" % \ (os.path.abspath("formatted_001.jpg")) self.assertEqual(expected_message, err_message) # Should not work without a path vimiv.paths = [] vimiv.fileextras.format_files("formatted_foo_") err_message = vimiv.statusbar.left_label.get_text() expected_message = "No files in path" self.assertEqual(expected_message, err_message) # Should not work in library vimiv.library.focus(True) vimiv.fileextras.format_files("formatted_bar_") err_message = vimiv.statusbar.left_label.get_text() expected_message = "Format only works on opened image files" self.assertEqual(expected_message, err_message) # Make sure nothing changed files = [fil for fil in os.listdir() if "formatted_" in fil] files = sorted(files) self.assertEqual(files, expected_files) # Clean up os.chdir("..") shutil.rmtree("testimages_to_format")
def main(running_tests=False): """Starting point for vimiv. Args: running_tests: If True running from testsuite. Do not run Gtk.main. """ parser = get_args() parse_dirs() settings = parse_config() settings = parse_args(parser, settings) args = settings["GENERAL"]["paths"] # Recursive and shuffling required immediately by populate recursive = settings["GENERAL"]["recursive"] shuffle_paths = settings["GENERAL"]["shuffle"] paths, index = populate(args, recursive, shuffle_paths) # Start the actual window signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C Vimiv(settings, paths, index).main() if not running_tests: Gtk.main()
def test_clear(self): """Clear Trash/Thumbnails.""" settings = parse_config() vimiv = v_main.Vimiv(settings, [], 0) vimiv.main() thumbdir = os.path.expanduser("~/.vimiv/Thumbnails") trashdir = os.path.expanduser("~/.vimiv/Trash") if not os.path.isdir("Thumbnail_bak"): shutil.copytree(thumbdir, "Thumbnail_bak") if not os.path.isdir("Trash_bak"): shutil.copytree(trashdir, "Trash_bak") # Make sure there are some files in the directories os.system("touch ~/.vimiv/Trash/foo") os.system("touch ~/.vimiv/Thumbnails/foo") vimiv.fileextras.clear("Thumbnails") vimiv.fileextras.clear("Trash") self.assertEqual(os.listdir(thumbdir), []) self.assertEqual(os.listdir(trashdir), []) # Move backups back to directory shutil.rmtree(thumbdir) shutil.rmtree(trashdir) shutil.move("Thumbnail_bak", thumbdir) shutil.move("Trash_bak", trashdir)
def setUp(self): self.parser = parser.get_args() self.config_settings = parser.parse_config()
def setUpClass(cls): cls.working_directory = os.getcwd() os.chdir("vimiv") cls.settings = parse_config() cls.vimiv = v_main.Vimiv(cls.settings, [], 0) cls.vimiv.main()
def setUpClass(cls): cls.initial_directory = os.getcwd() os.chdir("vimiv/testimages") cls.settings = parse_config() cls.vimiv = v_main.Vimiv(cls.settings, [], 0) cls.vimiv.main()
def setUp(self): self.working_directory = os.getcwd() os.chdir("vimiv") self.settings = parse_config()
def setUpClass(cls): cls.settings = parse_config() cls.vimiv = v_main.Vimiv(cls.settings, [], 0) cls.vimiv.main()