LCOV - code coverage report
Current view: top level - src/platform/assets/components - MediaImageTop.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 4 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2              :   <div class="relative size-full overflow-hidden rounded-sm bg-muted">
       3              :     <img
       4              :       v-if="!error"
       5              :       :src="asset.src"
       6              :       :alt="getAssetDisplayName(asset)"
       7              :       class="size-full object-contain transition-transform duration-300 group-hover:scale-105 group-data-[selected=true]:scale-105"
       8              :       :draggable="false"
       9              :     />
      10              :     <div
      11              :       v-else
      12              :       role="img"
      13              :       :aria-label="$t('g.imageFailedToLoad')"
      14              :       class="flex size-full items-center justify-center bg-muted"
      15              :     >
      16              :       <i class="icon-[lucide--image] size-7.5 text-muted-foreground" />
      17              :     </div>
      18              :   </div>
      19              : </template>
      20              : 
      21              : <script setup lang="ts">
      22              : import { whenever } from '@vueuse/core'
      23              : 
      24              : import { useImageQuiet } from '@/composables/useImageQuiet'
      25              : import type { AssetMeta } from '@/platform/assets/schemas/mediaAssetSchema'
      26              : import { getAssetDisplayName } from '@/platform/assets/utils/assetMetadataUtils'
      27              : 
      28              : const { asset } = defineProps<{
      29              :   asset: AssetMeta
      30              : }>()
      31              : 
      32          180 : const emit = defineEmits<{
      33              :   'image-loaded': [width: number, height: number]
      34              : }>()
      35              : 
      36          180 : const { state, error, isReady } = useImageQuiet({
      37              :   src: asset.src ?? '',
      38              :   alt: getAssetDisplayName(asset)
      39              : })
      40              : 
      41          180 : whenever(
      42              :   () =>
      43              :     isReady.value && state.value?.naturalWidth && state.value?.naturalHeight,
      44              :   () =>
      45              :     emit('image-loaded', state.value!.naturalWidth, state.value!.naturalHeight)
      46              : )
      47              : </script>
        

Generated by: LCOV version 2.0-1