文件
dayu-color/大鱼调色/Plugin/DYHSLPickerDiagnostics.inc.h
T

29 行
3.2 KiB
C

// Classifier boundaries and real native inspector selection, without opening a sampler.
{
const float points[][4]={{1,.04,.02,0},{1,.5,.02,1},{.95,.9,.02,2},{.03,.8,.05,3},{.02,.8,.8,4},{.02,.12,.9,5},{.55,.08,.95,6},{.95,.04,.6,7},
{.95,.8,.79,1},{.91,.7,.73,1},{.74,.46,.44,1},{.65,.42,.28,1},{.27,.16,.12,1},{.5,.5,.5,-1},{1,1,1,-1},{0,0,0,-1},{.5,.49,.48,-1},{NAN,.3,.2,-1}};
for(unsigned i=0;i<sizeof(points)/sizeof(points[0]);i++)run.record([NSString stringWithFormat:@"hsl-picker-colour-%02u",i],DYHSLPickedLane(points[i][0],points[i][1],points[i][2])==(int)points[i][3]);
DYDiagnosticManager *pickHost=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(pickHost,nil);
NSMutableDictionary *pickDoc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *pickLayer=DYInsertTool(pickDoc,@"hsl",@"base:hsl");DYWriteTools(pickHost,pickDoc,kCMTimeZero);
DYToolManager *pickProxy=[[[DYToolManager alloc]initWithHost:pickHost node:pickLayer]autorelease];
NSArray *pickEditors=@[[[[DYInspector alloc]initWithAPIManager:pickHost]autorelease],[[[DYInspector alloc]initWithAPIManager:pickProxy]autorelease],[[[DYInspector alloc]initWithAPIManager:pickHost renderer:nil workspaceType:@"hsl"]autorelease]];
NSDictionary *pickBefore=[[pickHost->_values copy]autorelease];NSData *pickTools=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(pickHost,kCMTimeZero) requiringSecureCoding:YES error:nil];
for(NSUInteger editorIndex=0;editorIndex<pickEditors.count;editorIndex++){
DYInspector *editor=pickEditors[editorIndex];editor.frame=NSMakeRect(0,0,424,780);[editor refresh];[editor layoutSubtreeIfNeeded];
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.02 green:.12 blue:.9 alpha:1]];
BOOL blue=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==5;
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.95 green:.8 blue:.79 alpha:1]];
BOOL skin=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==1;
[(id)editor performSelector:@selector(selectHSLColor:) withObject:[NSColor colorWithSRGBRed:.5 green:.5 blue:.5 alpha:1]];
[(id)editor performSelector:@selector(selectHSLColor:) withObject:nil];
BOOL retained=[[(NSDictionary*)[editor valueForKey:@"tabs"]objectForKey:@"hsl"]integerValue]==1,button=NO,swatch=NO;
for(NSDictionary *card in [editor valueForKey:@"cards"])if([card[@"section"][@"key"]isEqual:@"hsl"]){
for(NSView *row in card[@"body"]){if([row.identifier isEqual:@"hslPickerControls"])button=[(NSButton*)row.subviews.firstObject action]==@selector(sampleHSLLane:);
if([row.identifier isEqual:@"hslTabs"]){swatch=YES;for(NSButton *b in row.subviews)swatch&=(b.state==(b.tag==1?NSControlStateValueOn:NSControlStateValueOff));}}
}
run.record([NSString stringWithFormat:@"hsl-picker-native-editor-%lu",(unsigned long)editorIndex],blue&&skin&&retained&&button&&swatch);
}
NSData *pickAfter=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(pickHost,kCMTimeZero) requiringSecureCoding:YES error:nil];
run.record(@"hsl-picker-only-selects-no-grading-or-undo-write",[pickBefore isEqual:pickHost->_values]&&[pickTools isEqual:pickAfter]&&pickHost->_undoStarts==0);
}