LCOV - code coverage report
Current view: top level - src/renderer/extensions/layerEditor/composables - useLayerEditor.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 63.6 % 11 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { LAYER_EDITOR_DIALOG_KEY } from '@/renderer/extensions/layerEditor/layerEditorDialogKey'
       2              : import {
       3              :   LayerEditorDialogContent,
       4              :   LayerEditorDialogHeader,
       5              :   layerEditorDialogProps
       6              : } from '@/renderer/extensions/layerEditor/composables/layerEditorDialog'
       7              : import { t } from '@/i18n'
       8              : import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
       9              : import { useToast } from '@/components/ui/toast/toastStore'
      10              : import { useDialogStore } from '@/stores/dialogStore'
      11              : import { useNodeOutputStore } from '@/stores/nodeOutputStore'
      12              : 
      13            2 : export function useLayerEditor() {
      14            2 :   const openLayerEditor = (node: LGraphNode | null | undefined) => {
      15            2 :     if (!node) {
      16            0 :       console.error('[LayerEditor] No node provided')
      17            0 :       return
      18              :     }
      19              : 
      20            2 :     const imageUrls = useNodeOutputStore().getNodeImageUrls(node)
      21            2 :     if (!imageUrls || imageUrls.length < 2) {
      22            0 :       useToast().info(t('layerEditor.title'), {
      23              :         description: t('layerEditor.needsTwoImages')
      24              :       })
      25            0 :       return
      26              :     }
      27              : 
      28            2 :     useDialogStore().showDialog({
      29              :       key: LAYER_EDITOR_DIALOG_KEY,
      30              :       headerComponent: LayerEditorDialogHeader,
      31              :       component: LayerEditorDialogContent,
      32              :       props: {
      33              :         node
      34              :       },
      35              :       dialogComponentProps: layerEditorDialogProps
      36              :     })
      37              :   }
      38              : 
      39            2 :   return {
      40              :     openLayerEditor
      41              :   }
      42              : }
        

Generated by: LCOV version 2.0-1