feat: restore five themes and native LUT thumbnail library with source-frame previews
这个提交包含在:
1 父节点
c5441fab87
当前提交
61ea1c64a0
17 个文件已更改
+4944
-95
没有与搜索条件相匹配的文件
+1
-1
@@ -91,7 +91,7 @@ def main():
|
||||
run('pluginkit','-a',str(DEST/PLUGIN));registry=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
|
||||
entries=[l for l in registry.splitlines() if 'com.dayu.color.XPC(' in l]
|
||||
if len(entries)!=1 or not entries[0].rstrip().endswith('\t'+str(DEST/PLUGIN)):raise RuntimeError('PluginKit发现多份/错误版本: '+registry)
|
||||
record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version='1.0.0',build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=hashlib.sha256(TEMPLATE.read_bytes()).hexdigest(),shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest())
|
||||
record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=hashlib.sha256(TEMPLATE.read_bytes()).hexdigest(),shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest())
|
||||
output=ROOT/'verification/Delivery.json';output.write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n')
|
||||
run('open',str(DEST));print('FORMAL_INSTALLED. Run installed self-test and host verification; type complete only after success. Type leave to preserve pending state.',flush=True)
|
||||
for decision in sys.stdin:
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "../大鱼调色/Plugin/DYLUTLibrary.h"
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
|
||||
static NSUInteger checkCount=0;
|
||||
static NSMutableArray *results;
|
||||
static void require(BOOL condition,NSString *label) {
|
||||
++checkCount;[results addObject:@{@"name":label,@"pass":@(condition)}];
|
||||
if(!condition){fprintf(stderr,"FAIL: %s\n",label.UTF8String);exit(1);}
|
||||
}
|
||||
static BOOL near(float a,float b){return fabsf(a-b)<1e-6f;}
|
||||
static NSString *cube(float redGain=1,NSString *domain=@"") {
|
||||
NSMutableString *text=[NSMutableString stringWithFormat:@"TITLE \"Dayu test only\"\nLUT_3D_SIZE 2\n%@",domain];
|
||||
for(int b=0;b<2;b++)for(int g=0;g<2;g++)for(int r=0;r<2;r++)[text appendFormat:@"%.8f %d %d\n",r*redGain,g,b];return text;
|
||||
}
|
||||
static NSURL *write(NSURL *root,NSString *relative,NSString *text) {
|
||||
NSURL *url=[root URLByAppendingPathComponent:relative];NSError *error=nil;
|
||||
require([NSFileManager.defaultManager createDirectoryAtURL:url.URLByDeletingLastPathComponent withIntermediateDirectories:YES attributes:nil error:&error],@"create fixture directory");
|
||||
require([text writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:&error],@"write fixture");return url;
|
||||
}
|
||||
static NSData *sample(float r,float g,float b,float a=1) {float p[]={r,g,b,a};return [NSData dataWithBytes:p length:sizeof(p)];}
|
||||
|
||||
int main(int argc,const char **argv){@autoreleasepool{
|
||||
results=[NSMutableArray new];
|
||||
NSURL *temporary=[NSURL fileURLWithPath:[NSTemporaryDirectory()stringByAppendingPathComponent:[@"dayu-lut-library-" stringByAppendingString:NSUUID.UUID.UUIDString]] isDirectory:YES];
|
||||
NSFileManager *fm=NSFileManager.defaultManager;NSError *error=nil;
|
||||
require([fm createDirectoryAtURL:temporary withIntermediateDirectories:YES attributes:nil error:&error],@"isolated temporary directory");
|
||||
NSURL *source=[temporary URLByAppendingPathComponent:@"Sources"],*libraryURL=[temporary URLByAppendingPathComponent:@"Library"];
|
||||
NSURL *identity=write(source,@"Identity.cube",cube()),*red=write(source,@"Red.cube",cube(1.5f));
|
||||
NSURL *domain=write(source,@"Domain.cube",cube(1,@"DOMAIN_MIN 0 0 0\nDOMAIN_MAX 2 2 2\n"));
|
||||
std::vector<float> values;NSUInteger n=0;
|
||||
require(DYLUTReadCube(identity.path,values,n,&error)&&n==2&&values.size()==32,@"identity Cube parses");
|
||||
for(int b=0;b<2;b++)for(int g=0;g<2;g++)for(int r=0;r<2;r++) {
|
||||
NSUInteger i=((b*2+g)*2+r)*4;
|
||||
require(near(values[i],r)&&near(values[i+1],g)&&near(values[i+2],b)&&near(values[i+3],1),@"Cube order is red-fastest");
|
||||
}
|
||||
NSData *input=sample(.37,.28,.81,.6);const float *out;
|
||||
NSData *neutral=DYLUTTransformRGBA(input,1,1,identity.path,&error);out=(const float *)neutral.bytes;
|
||||
require(neutral&&near(out[0],.37)&&near(out[1],.28)&&near(out[2],.81)&&near(out[3],.6),@"identity interpolation and alpha");
|
||||
NSData *gain=DYLUTTransformRGBA(input,1,1,red.path,&error);out=(const float *)gain.bytes;
|
||||
require(gain&&near(out[0],.555)&&near(out[1],.28)&&near(out[2],.81),@"red gain trilinear interpolation");
|
||||
NSData *ranged=DYLUTTransformRGBA(input,1,1,domain.path,&error);out=(const float *)ranged.bytes;
|
||||
require(ranged&&near(out[0],.185)&&near(out[1],.14)&&near(out[2],.405),@"DOMAIN normalization resamples Cube");
|
||||
NSData *clear=DYLUTTransformRGBA(sample(NAN,.2,.3),1,1,nil,&error);out=(const float *)clear.bytes;
|
||||
require(clear&&out[0]==0&&out[1]==0&&out[2]==0&&out[3]==0,@"invalid float samples become clear");
|
||||
require(!DYLUTTransformRGBA([NSData data],1,1,nil,&error),@"reject malformed float RGBA length");
|
||||
require(!DYLUTTransformRGBA(input,0,1,nil,&error),@"reject zero image width");
|
||||
NSImage *thumbnail=DYLUTThumbnail(red.path,input,1,1,NSMakeSize(64,36),&error);
|
||||
require(thumbnail&&NSEqualSizes(thumbnail.size,NSMakeSize(64,36)),@"thumbnail bitmap generated without GUI");
|
||||
NSBitmapImageRep *rep=(NSBitmapImageRep *)thumbnail.representations.firstObject;
|
||||
require(rep.pixelsWide==64&&rep.pixelsHigh==36&&abs(rep.bitmapData[0]-142)<=1&&abs(rep.bitmapData[3]-153)<=1,@"thumbnail reflects LUT colors and alpha");
|
||||
require(DYLUTThumbnail(identity.path,nil,0,0,NSMakeSize(80,45),&error)!=nil,@"authored fallback chart thumbnail");
|
||||
require(!DYLUTThumbnail(nil,nil,0,0,NSMakeSize(0,45),&error),@"reject invalid thumbnail size");
|
||||
NSDictionary *oldAttributes=[fm attributesOfItemAtPath:red.path error:&error];
|
||||
require([cube(1.6f)writeToURL:red atomically:NO encoding:NSUTF8StringEncoding error:&error],@"rewrite LUT in place");
|
||||
NSDate *preciseChange=[oldAttributes[NSFileModificationDate]dateByAddingTimeInterval:.005];
|
||||
require([fm setAttributes:@{NSFileModificationDate:preciseChange}ofItemAtPath:red.path error:&error],@"preserve subsecond modification distinction");
|
||||
require(DYLUTReadCube(red.path,values,n,&error)&&near(values[4],1.6),@"cache invalidates same-size in-place rewrite");
|
||||
std::atomic_bool parallelOK{true};std::atomic_bool *parallelState=¶llelOK;
|
||||
dispatch_apply(64,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0),^(size_t index){@autoreleasepool{
|
||||
(void)index;std::vector<float> local;NSUInteger dimension=0;
|
||||
if(!DYLUTReadCube(red.path,local,dimension,NULL)||dimension!=2||!near(local[4],1.6))parallelState->store(false);
|
||||
}});
|
||||
require(parallelOK,@"concurrent table cache reads stay consistent");
|
||||
NSArray *invalid=@[@"LUT_3D_SIZE 1\n0 0 0\n",@"LUT_3D_SIZE 129\n",@"LUT_3D_SIZE 2\n0 0 0\n",@"LUT_1D_SIZE 2\n0 0 0\n1 1 1\n",@"LUT_3D_SIZE 2\nNaN 0 0\n",[cube() stringByAppendingString:@"0 0 0\n"],[cube() stringByAppendingString:@"DOMAIN_MAX 0 1 1\n"],[cube() stringByAppendingString:@"garbage\n"],[cube() stringByAppendingString:@"LUT_3D_SIZE 2\n"]];
|
||||
NSUInteger invalidIndex=0;
|
||||
for(NSString *text in invalid) {
|
||||
NSURL *url=write(temporary,[NSString stringWithFormat:@"Invalid%lu.cube",(unsigned long)invalidIndex++],text);
|
||||
require(!DYLUTReadCube(url.path,values,n,&error)&&values.empty()&&n==0,@"reject invalid Cube and clear output");
|
||||
}
|
||||
DYLUTLibrary *library=[[[DYLUTLibrary alloc]initWithRootURL:libraryURL]autorelease];
|
||||
require([DYLUTLibrary.defaultRootURL.path hasSuffix:@"/Movies/大鱼调色LUT/look LUTs"],@"default library follows product Movies structure");
|
||||
require([library reload:&error]&&library.entries.count==0&&![fm fileExistsAtPath:libraryURL.path],@"scan missing root is read only and empty");
|
||||
NSArray *imported=[library importURLs:@[identity] error:&error];
|
||||
require(imported.count==1&&library.entries.count==1,@"single LUT import and scan");
|
||||
NSString *firstPath=imported[0][@"path"];NSData *firstContents=[NSData dataWithContentsOfFile:firstPath];
|
||||
NSArray *duplicate=[library importURLs:@[identity] error:&error];
|
||||
require(duplicate.count==1&&![duplicate[0][@"path"]isEqual:firstPath]&&library.entries.count==2,@"name collision creates unique copy");
|
||||
require([[NSData dataWithContentsOfFile:firstPath]isEqual:firstContents],@"existing LUT remains byte-for-byte unchanged");
|
||||
require([fm fileExistsAtPath:identity.path],@"import keeps original file");
|
||||
NSURL *folder=write(source,@"Cinema/Warm/Amber.cube",cube(1.2));
|
||||
write(source,@"Cinema/Cool/Blue.cube",cube(.8));write(source,@"Cinema/notes.txt",@"not a LUT");
|
||||
NSURL *link=[source URLByAppendingPathComponent:@"Cinema/Linked.cube"];
|
||||
require([fm createSymbolicLinkAtURL:link withDestinationURL:identity error:&error],@"create symlink fixture");
|
||||
NSArray *recursive=[library importURLs:@[[folder URLByDeletingLastPathComponent].URLByDeletingLastPathComponent] error:&error];
|
||||
require(recursive.count==2&&library.entries.count==4,@"directory recursively imports Cube only and skips symlinks");
|
||||
require([library.folders containsObject:@"Cinema/Warm"]&&[library.folders containsObject:@"Cinema/Cool"],@"nested folder structure preserved");
|
||||
require([library.entries[2][@"name"]length]>0&&[library.entries[2][@"relativeFolder"]isKindOfClass:NSString.class],@"entry has browser metadata");
|
||||
require(![library importURLs:@[link] error:&error],@"direct symbolic link import rejected");
|
||||
require(![library importURLs:@[[NSURL fileURLWithPath:firstPath]] error:&error],@"self library import rejected");
|
||||
require(![library importURLs:@[[NSURL URLWithString:@"https://example.com/a.cube"]] error:&error],@"remote URL import rejected");
|
||||
NSURL *invalidFolder=[temporary URLByAppendingPathComponent:@"InvalidPack"];
|
||||
write(invalidFolder,@"Good.cube",cube());write(invalidFolder,@"Bad.cube",@"invalid");
|
||||
NSUInteger before=library.entries.count;
|
||||
require(![library importURLs:@[invalidFolder] error:&error]&&library.entries.count==before,@"invalid folder preflight prevents partial imports");
|
||||
NSURL *blocked=write(source,@"Blocked/One.cube",cube());
|
||||
NSURL *outside=[temporary URLByAppendingPathComponent:@"Outside" isDirectory:YES];
|
||||
require([fm createDirectoryAtURL:outside withIntermediateDirectories:YES attributes:nil error:&error],@"create outside destination fixture");
|
||||
NSURL *destinationLink=[library.rootURL URLByAppendingPathComponent:@"Blocked"];
|
||||
require([fm createSymbolicLinkAtURL:destinationLink withDestinationURL:outside error:&error],@"create destination directory symlink fixture");
|
||||
require(![library importURLs:@[red,blocked.URLByDeletingLastPathComponent] error:&error],@"linked destination rejected and new files rolled back");
|
||||
require(![fm fileExistsAtPath:[[outside URLByAppendingPathComponent:@"One.cube"]path]],@"import cannot escape via existing directory link");
|
||||
require([library reload:&error]&&library.entries.count==before,@"rollback preserves previous library contents");
|
||||
require([library setFavorite:YES forPath:firstPath error:&error]&&[library isFavoritePath:firstPath],@"favorite is persisted");
|
||||
DYLUTLibrary *second=[[[DYLUTLibrary alloc]initWithRootURL:libraryURL]autorelease];
|
||||
require([second isFavoritePath:firstPath],@"favorite survives library recreation");
|
||||
require([second setFavorite:NO forPath:firstPath error:&error]&&![second isFavoritePath:firstPath],@"favorite removal persists");
|
||||
require(![second setFavorite:YES forPath:identity.path error:&error],@"favorite outside root rejected");
|
||||
NSDictionary *report=@{@"pass":@YES,@"checks":@(checkCount),@"results":results,@"scope":@"Standalone library/parser/bitmap checks on synthetic LUT files in an isolated temporary directory. No GUI or user library modified."};
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:&error];
|
||||
if(argc>1)require([json writeToFile:[NSString stringWithUTF8String:argv[1]] atomically:YES],@"write test report");
|
||||
fwrite(json.bytes,1,json.length,stdout);puts("");
|
||||
require([fm removeItemAtURL:temporary error:&error],@"clean isolated temporary fixtures");[results release];return 0;
|
||||
}}
|
||||
在新工单中引用
屏蔽一个用户