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

Method get_tmp_image_path

Test/astc_test_functional.py:186–235  ·  view source on GitHub ↗

Get the path of a temporary output image on disk. Temporary files are automatically cleaned up when the test tearDown occurs. Args: profile: The color profile. 'EXP' means explicit which means the 'mode' parameter is interpreted as a lit

(self, profile: str, mode: str)

Source from the content-addressed store, hash-verified

184 return script_dir / 'Data' / file_name
185
186 def get_tmp_image_path(self, profile: str, mode: str) -> Path:
187 '''
188 Get the path of a temporary output image on disk.
189
190 Temporary files are automatically cleaned up when the test tearDown
191 occurs.
192
193 Args:
194 profile: The color profile. 'EXP' means explicit which means
195 the 'mode' parameter is interpreted as a literal file
196 extension not a symbolic mode.
197 mode: The type of image to load.
198
199 Return:
200 The path to the test image file on disk.
201 '''
202 # Handle explicit mode
203 if profile == 'EXP':
204 file_handle, path = tempfile.mkstemp(mode, dir=self.tmp_dir.name)
205 os.close(file_handle)
206 os.remove(path)
207 return Path(path)
208
209 # Handle symbolic modes
210 file_exts = {
211 'LDR': {
212 'comp': '.astc',
213 'decomp': '.png',
214 'bad': '.foo'
215 },
216 'LDRS': {
217 'comp': '.astc',
218 'decomp': '.png',
219 'bad': '.foo'
220 },
221 'HDR': {
222 'comp': '.astc',
223 'decomp': '.exr',
224 'bad': '.foo'
225 }
226 }
227
228 assert profile in file_exts
229 assert mode in file_exts['LDR']
230
231 suffix = file_exts[profile][mode]
232 file_handle, path = tempfile.mkstemp(suffix, dir=self.tmp_dir.name)
233 os.close(file_handle)
234 os.remove(path)
235 return Path(path)
236
237
238class CLIPTest(CLITestBase):

Callers 15

test_ldr_compressMethod · 0.80
test_srgb_compressMethod · 0.80
test_hdr_compress1Method · 0.80
test_hdr_compress2Method · 0.80
test_ldr_decompressMethod · 0.80
test_srgb_decompressMethod · 0.80
test_hdr_decompress1Method · 0.80
test_hdr_decompress2Method · 0.80
test_ldr_roundtripMethod · 0.80
test_srgb_roundtripMethod · 0.80
test_hdr_roundtrip1Method · 0.80
test_hdr_roundtrip2Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected