def test_invalid_setters(self): valid_path = Path(__file__).parent.joinpath('output/valid.png') invalid_path = Path(__file__).parent.joinpath('output/invalid.wat') with self.assertRaises(RuntimeError): canvas_builder = CanvasBuilder() canvas_builder.set_size(Cu.from_mm(1), Cu.from_mm(1)) canvas_builder.set_path(invalid_path) with self.assertRaises(RuntimeError): canvas_builder = CanvasBuilder() canvas_builder.set_path(valid_path) canvas_builder.set_size(Cu.from_mm(-1), Cu.from_mm(1)) with self.assertRaises(RuntimeError): canvas_builder = CanvasBuilder() canvas_builder.set_path(valid_path) canvas_builder.set_size(Cu.from_mm(1), Cu.from_mm(-1)) with self.assertRaises(RuntimeError): canvas_builder = CanvasBuilder() canvas_builder.set_path(valid_path) canvas_builder.set_size(Cu.from_mm(1), Cu.from_mm(1)) canvas_builder.set_anti_alias_mode(-1) with self.assertRaises(RuntimeError): canvas_builder = CanvasBuilder() canvas_builder.set_path(valid_path) canvas_builder.set_size(Cu.from_mm(1), Cu.from_mm(1)) canvas_builder.set_anti_alias_mode(7)
def test_setting_alias_modes(self): canvas_builder = CanvasBuilder() canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_DEFAULT) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_NONE) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_GRAY) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_SUBPIXEL) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_FAST) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_GOOD) canvas_builder.set_anti_alias_mode(cairo.ANTIALIAS_BEST)