import 'package:flutter_test/flutter_test.dart'; import 'package:fikoyt_studyo/comfy/workflow/video_workflow.dart'; void main() { test('T2V: ayrı T5 CLIP + EmptyLTXVLatentVideo + CreateVideo', () { final w = videoWorkflowOlustur(VideoParametreleri( prompt: 'a beach at sunset', seed: 7, genislik: 768, yukseklik: 512, uzunluk: 97, fps: 24, )); expect(w['1']['inputs']['ckpt_name'], 'ltx-video-2b-v0.9.5.safetensors'); expect(w['11']['class_type'], 'CLIPLoader'); expect(w['11']['inputs']['type'], 'ltxv'); expect(w['2']['inputs']['text'], 'a beach at sunset'); expect(w['2']['inputs']['clip'], ['11', 0]); // T5 ayrı expect(w['4']['class_type'], 'EmptyLTXVLatentVideo'); expect(w['4']['inputs']['length'], 97); expect(w['7']['inputs']['positive'], ['5', 0]); // LTXVConditioning expect(w['9']['class_type'], 'CreateVideo'); expect(w['10']['class_type'], 'SaveVideo'); // T2V'de I2V node'ları yok expect(w.containsKey('12'), isFalse); expect(w.containsKey('13'), isFalse); }); test('I2V (ilk kare): LoadImage + LTXVAddGuide frame_idx 0', () { final w = videoWorkflowOlustur(VideoParametreleri( prompt: 'gentle motion', kaynakResim: 'kaynak.png', seed: 3, )); expect(w['20']['class_type'], 'LoadImage'); expect(w['20']['inputs']['image'], 'kaynak.png'); expect(w['30']['class_type'], 'LTXVAddGuide'); expect(w['30']['inputs']['image'], ['20', 0]); expect(w['30']['inputs']['frame_idx'], 0); // KSampler conds + latent rehber çıkışından expect(w['7']['inputs']['positive'], ['30', 0]); expect(w['7']['inputs']['negative'], ['30', 1]); expect(w['7']['inputs']['latent_image'], ['30', 2]); // T2V latent tabanı her zaman var (EmptyLTXVLatentVideo) expect(w['4']['class_type'], 'EmptyLTXVLatentVideo'); }); test('first+middle+last frame: 3 LTXVAddGuide zinciri', () { final w = videoWorkflowOlustur(VideoParametreleri( prompt: 'x', ilkKare: 'a.png', ortaKare: 'b.png', sonKare: 'c.png', uzunluk: 97, )); expect(w['30']['inputs']['frame_idx'], 0); // ilk expect(w['31']['inputs']['frame_idx'], 48); // orta (97~/2) expect(w['32']['inputs']['frame_idx'], 96); // son (97-1) // zincirleme: 31 girişi 30 çıkışından, 32 girişi 31 çıkışından expect(w['31']['inputs']['positive'], ['30', 0]); expect(w['32']['inputs']['latent'], ['31', 2]); expect(w['7']['inputs']['positive'], ['32', 0]); }); test('ses dosyası: LoadAudio + CreateVideo.audio', () { final w = videoWorkflowOlustur(VideoParametreleri( prompt: 'x', sesModu: SesModu.dosya, sesDosya: 'muzik.mp3')); expect(w['15']['class_type'], 'LoadAudio'); expect(w['15']['inputs']['audio'], 'muzik.mp3'); expect(w['9']['inputs']['audio'], ['15', 0]); }); test('LoRA zinciri: LoraLoaderModelOnly → ModelSamplingLTXV', () { final w = videoWorkflowOlustur(VideoParametreleri(prompt: 'x', loralar: [ VideoLora(dosya: 'l1.safetensors', guc: 0.8), ])); expect(w['40']['class_type'], 'LoraLoaderModelOnly'); expect(w['40']['inputs']['lora_name'], 'l1.safetensors'); expect(w['40']['inputs']['model'], ['1', 0]); expect(w['6']['inputs']['model'], ['40', 0]); // ModelSamplingLTXV loralı modeli alır }); test('süre ve i2v hesabı', () { final p = VideoParametreleri(uzunluk: 97, fps: 24); expect(p.sureSn, closeTo(4.04, 0.01)); expect(p.i2vMi, isFalse); expect(p.kopyala(kaynakResim: 'x.png').i2vMi, isTrue); }); test('json round-trip (yeni alanlar dahil)', () { final p = VideoParametreleri( prompt: 't', seed: 9, uzunluk: 73, kaynakResim: 'a.png', ortaKare: 'm.png', sonKare: 'z.png', sesModu: SesModu.dosya, sesDosya: 's.mp3', loralar: [VideoLora(dosya: 'l.safetensors', guc: 0.7)]); final geri = VideoParametreleri.fromJson(p.toJson()); expect(geri.prompt, 't'); expect(geri.uzunluk, 73); expect(geri.kaynakResim, 'a.png'); expect(geri.ortaKare, 'm.png'); expect(geri.sonKare, 'z.png'); expect(geri.sesModu, SesModu.dosya); expect(geri.sesDosya, 's.mp3'); expect(geri.loralar.length, 1); expect(geri.loralar.first.guc, 0.7); }); }