diff --git a/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h index 51b1403..b338991 100644 --- a/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h @@ -87,3 +87,37 @@ run.record(@"canvas-curve-histogram-updates-from-final-output-at-the-same-playhead",before.length==sizeof(DYHistogram)&&after.length==sizeof(DYHistogram)&&![before isEqual:after]&&![bridge canvasHistogramAtTime:CMTimeMake(1,24)]); [plugin release]; } + + +{ + DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error); + DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero; + id plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host]; + [plugin scheduleToolCanvasRegistration];NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error]; + auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.1;while(NSProcessInfo.processInfo.systemUptime osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host]; + DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease]; + [osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero]; + id viewer=[(id)osc valueForKey:@"viewerControls"];NSRect button=NSZeroRect; + for(NSDictionary *a in [viewer valueForKey:@"areas"])if([a[@"toolType"]isEqual:@"cloneStamp"])button=[a[@"rect"]rectValue]; + Pixels rendered=read(overlay,gpu);NSUInteger opaque=0; + for(NSUInteger i=0;i<640*400;i++)opaque+=rendered[4*i+3]>.01; + run.record(@"native-osc-renders-the-cropped-toolbar-on-a-transparent-texture",!NSIsEmptyRect(button)&&opaque>100&&opaque<640*400*.08&&rendered[(200*640+320)*4+3]==0,@{@"opaquePixels":@(opaque)}); + BOOL update=NO; + auto down=[&](double x,double y){NSInteger part=0;[osc hitTestOSCAtMousePositionX:x mousePositionY:y activePart:&part atTime:kCMTimeZero];[osc mouseDownAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];return part;}; + auto up=[&](double x,double y,NSInteger part){[osc mouseUpAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];}; + auto click=[&](double x,double y){NSInteger part=down(x,y);up(x,y,part);}; + int undo=base->_undoStarts; + click(NSMidX(button),400-NSMidY(button)); + click(180,291.25); // normalized source (0.25, 0.25) + NSInteger part=down(348,244); + [osc mouseDraggedAtPositionX:460 positionY:181 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero]; + up(460,181,part);drain(); + NSDictionary *stamp=[DYSharedMasks(DYReadTools(host,kCMTimeZero).document) firstObject];NSArray *source=stamp[@"stampSource"]; + DYMaskParameters target=DYMaskAtTime(stamp,kCMTimeZero); + run.record(@"native-osc-creates-one-stamp-and-one-undo-from-source-click-and-drag",source.count==4&&fabs([source[0]doubleValue]-.25)<1e-6&&fabs([source[1]doubleValue]-.25)<1e-6&&fabs(target.centerX-.65)<1e-6&&fabs(target.centerY-.5)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1); + [osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero]; + click(251,104);drain(); // first draw has top-down viewport y=30...345, forward button is x=212...290. + run.record(@"native-osc-stamp-forward-action-starts-the-existing-host-tracker",host->_forwardStarts==1&&host->_backwardStarts==0); + [plugin cleanupAnalysis:nil];drain();[(id)osc release];[(id)plugin release]; +} diff --git a/大鱼调色/Plugin/DYViewerParameterDiagnostics.inc.h b/大鱼调色/Plugin/DYViewerParameterDiagnostics.inc.h index 4ba4b16..18b320f 100644 --- a/大鱼调色/Plugin/DYViewerParameterDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYViewerParameterDiagnostics.inc.h @@ -13,7 +13,11 @@ [document setObject:@[@"base"] forKey:@"removedBase"]; run.record(@"viewer-bridge-published-snapshot-is-immutable-and-frame-bound",[snapshot[@"uniforms"]length]==sizeof(DYUniforms)&&![snapshot[@"document"][@"removedBase"]count]&&![bridge snapshotAtTime:CMTimeMake(1,24)]); int undo=base->_undoStarts; - [bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.4];drain(); + [bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.4]; + // Wait for the asynchronous write itself, allowing a busy test runner to + // service the main queue before asserting the still-open undo group. + double writeDeadline=NSProcessInfo.processInfo.systemUptime+.5; + while(fabs(value(exposure)-.4)>=1e-6&&NSProcessInfo.processInfo.systemUptime_undoStarts==undo+1&&base->_undoEnds==undo); [bridge changeValue:.8];[bridge endGesture];[bridge endGesture];drain(); run.record(@"viewer-bridge-continuous-drag-closes-one-host-undo-group",fabs(value(exposure)-.8)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);