MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / __init__

Method __init__

Test/testlib/testset.py:82–115  ·  view source on GitHub ↗

Create a new image definition, based on a structured file path. Args: file_path: The path of the image on disk. Raise: TestImageException: The image is not found or path is malformed.

(self, file_path: Path)

Source from the content-addressed store, hash-verified

80 }
81
82 def __init__(self, file_path: Path):
83 '''
84 Create a new image definition, based on a structured file path.
85
86 Args:
87 file_path: The path of the image on disk.
88
89 Raise:
90 TestImageException: The image is not found or path is malformed.
91 '''
92 self.file_path = file_path.resolve()
93 if not self.file_path.exists():
94 raise TestImageException(f'Image does not exist ({file_path})')
95
96 self.test_set = file_path.parent.parent.name
97 self.test_format = file_path.parent.name
98 self.file_name = file_path.name
99
100 # Decode the mandatory fields
101 self.color_profile = self._decode_color_profile(file_path.stem)
102 self.color_format = self._decode_color_format(file_path.stem)
103 self.name = self._decode_name(file_path.stem)
104
105 # Decode flags
106 flags = self._decode_flags(file_path.stem)
107 self.is_3d = '3' in flags
108 self.is_alpha_scaled = 'a' in flags
109
110 # Output file path, with file stored without extension
111 # TODO: Move this elsewhere as it assumes the directory structure
112 root_dir = Path(__file__).parent.parent
113 self.file_path_out = \
114 root_dir / 'TestOutput' / \
115 self.test_set / self.test_format / file_path.stem
116
117 def _decode_color_profile(self, file_name: str) -> str:
118 '''

Callers

nothing calls this directly

Calls 5

_decode_color_profileMethod · 0.95
_decode_color_formatMethod · 0.95
_decode_nameMethod · 0.95
_decode_flagsMethod · 0.95
TestImageExceptionClass · 0.85

Tested by

no test coverage detected