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)
def assertFindCompatibleMatches(self, format_str, family_str, everywhere, little_endian, big_endian, treat_x_as_a=False, treat_srgb_as_unorm=False, ignore_data_types=False): compatibility = pfg.find_compatible( format_str, family_str, treat_x_as_a=treat_x_as_a, treat_srgb_as_unorm=treat_srgb_as_unorm, ignore_data_types=ignore_data_types) # assertCountEqual checks for the existence of items regardless # of order (and has a misleading name...) self.assertCountEqual(everywhere, compatibility.everywhere) self.assertCountEqual(little_endian, compatibility.little_endian) self.assertCountEqual(big_endian, compatibility.big_endian)