def test_displays_family_documentation(self): pfg.main(["pfg", "document", "vulkan"]) doc = pfg.document("vulkan") output = self.get_stdout_without_error() self.assertEqual(doc + "\n", output)
def test_reports_no_family_documentation(self): pfg.main(["pfg", "document", "unknown_family"]) error = self.get_stderr_without_output() self.assertIn("Unknown", error) self.assertIn("unknown_family", error)
def test_reports_unknown_format(self): pfg.main(["pfg", "describe", "unknown_format"]) error = self.get_stderr_without_output() self.assertIn("Unknown", error) self.assertIn("unknown_format", error)
def test_reports_unknown_family_for_list_formats(self): pfg.main(["pfg", "list-formats", "unknown_family"]) formats = pfg.list_formats("unknown_family") error = self.get_stderr_without_output() self.assertIn("Unknown", error) self.assertIn("unknown_family", error)
def test_lists_formats(self): pfg.main(["pfg", "list-formats", "cairo"]) formats = pfg.list_formats("cairo") output = self.get_stdout_without_error() for f in formats: self.assertIn(f, output)
def test_lists_families(self): pfg.main(["pfg", "list-families"]) families = pfg.list_families() output = self.get_stdout_without_error() for f in families: self.assertIn(f, output)
def test_reports_unknown_format_for_find_compatible(self): pfg.main(["pfg", "find-compatible", "VK_FORMAT_B8G8R8A8", "opengl"]) error = self.get_stderr_without_output() self.assertIn("Unknown", error) self.assertIn("VK_FORMAT_B8G8R8A8", error) self.assertIn("opengl", error)
def test_reports_unknown_family_for_find_compatible(self): pfg.main(["pfg", "find-compatible", "VK_FORMAT_B8G8R8A8_UNORM", "unknown_family"]) error = self.get_stderr_without_output() self.assertIn("Unknown", error) self.assertIn("VK_FORMAT_B8G8R8A8_UNORM", error) self.assertIn("unknown_family", error)
def test_describes_format_without_native_description(self): pfg.main(["pfg.py", "describe", "VK_FORMAT_R8G8B8_UNORM"]) description = pfg.describe("VK_FORMAT_R8G8B8_UNORM") output = self.get_stdout_without_error() self.assertIn(" " + description.data_type, output) self.assertIn(memory_to_str(description.memory_le), output) self.assertIn(memory_to_str(description.memory_be), output) self.assertIn("Bytes in memory", output)
def test_describes_format_with_native_description(self): pfg.main(["pfg.py", "describe", "VK_FORMAT_R5G6B5_UNORM_PACK16"]) description = pfg.describe("VK_FORMAT_R5G6B5_UNORM_PACK16") output = self.get_stdout_without_error() self.assertIn(native_to_str(description.native), output) self.assertIn(memory_to_str(description.memory_le), output) self.assertIn(memory_to_str(description.memory_be), output) self.assertIn("Native 16-bit type", output)
def test_describes_format_without_bit_indices(self): pfg.main(["pfg.py", "describe", "--hide-bit-indices", "VK_FORMAT_R5G6B5_UNORM_PACK16"]) description = pfg.describe("VK_FORMAT_R5G6B5_UNORM_PACK16") output = self.get_stdout_without_error() self.assertIn(" " + description.data_type, output) self.assertIn(remove_subscripts(native_to_str(description.native)), output) self.assertIn(remove_subscripts(memory_to_str(description.memory_le)), output) self.assertIn(remove_subscripts(memory_to_str(description.memory_be)), output) self.assertIn("Native 16-bit type", output)
def test_finds_compatible_formats(self): pfg.main(["pfg", "find-compatible", "VK_FORMAT_B8G8R8A8_UNORM", "opengl"]) compatibility = pfg.find_compatible("VK_FORMAT_B8G8R8A8_UNORM", "opengl") output = self.get_stdout_without_error() for f in compatibility.everywhere: self.assertIn(f, output) for f in compatibility.little_endian: self.assertIn(f, output) for f in compatibility.big_endian: self.assertIn(f, output)
def test_finds_compatible_formats_when_ignoring_data_type(self): pfg.main([ "pfg", "find-compatible", "--ignore-data-types", "VK_FORMAT_B8G8R8A8_SSCALED", "wayland_drm"]) compatibility = pfg.find_compatible( "VK_FORMAT_B8G8R8A8_SSCALED", "wayland_drm", ignore_data_types=True) output = self.get_stdout_without_error() for f in compatibility.everywhere: self.assertIn(f, output) for f in compatibility.little_endian: self.assertIn(f, output) for f in compatibility.big_endian: self.assertIn(f, output)
def test_finds_compatible_formats_when_treating_srgb_as_unorm(self): pfg.main([ "pfg", "find-compatible", "--treat-srgb-as-unorm", "VK_FORMAT_B8G8R8A8_SRGB", "wayland_drm"]) compatibility = pfg.find_compatible( "VK_FORMAT_B8G8R8A8_SRGB", "wayland_drm", ignore_data_types=True) output = self.get_stdout_without_error() for f in compatibility.everywhere: self.assertIn(f, output) for f in compatibility.little_endian: self.assertIn(f, output) for f in compatibility.big_endian: self.assertIn(f, output)
def test_finds_compatible_formats_treating_x_as_a(self): pfg.main([ "pfg", "find-compatible", "--treat-x-as-a", "VK_FORMAT_B8G8R8A8_UNORM", "wayland_drm"]) compatibility = pfg.find_compatible( "VK_FORMAT_B8G8R8A8_UNORM", "wayland_drm", treat_x_as_a=True) output = self.get_stdout_without_error() for f in compatibility.everywhere: self.assertIn(f, output) for f in compatibility.little_endian: self.assertIn(f, output) for f in compatibility.big_endian: self.assertIn(f, output)