From a8eae73b66bb30879d17c01daad5ee834462eaad Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sat, 8 Feb 2014 20:46:04 +0100 Subject: [PATCH] manual test --- Tests/Manual/CPTextView/AppController.j | 102 +++++++++++++++++ Tests/Manual/CPTextView/Info.plist | 10 ++ Tests/Manual/CPTextView/Jakefile | 94 ++++++++++++++++ Tests/Manual/CPTextView/Resources/spinner.gif | Bin 0 -> 1434 bytes Tests/Manual/CPTextView/index-debug.html | 103 ++++++++++++++++++ Tests/Manual/CPTextView/index.html | 77 +++++++++++++ Tests/Manual/CPTextView/main.j | 18 +++ 7 files changed, 404 insertions(+) create mode 100755 Tests/Manual/CPTextView/AppController.j create mode 100644 Tests/Manual/CPTextView/Info.plist create mode 100644 Tests/Manual/CPTextView/Jakefile create mode 100644 Tests/Manual/CPTextView/Resources/spinner.gif create mode 100644 Tests/Manual/CPTextView/index-debug.html create mode 100644 Tests/Manual/CPTextView/index.html create mode 100644 Tests/Manual/CPTextView/main.j diff --git a/Tests/Manual/CPTextView/AppController.j b/Tests/Manual/CPTextView/AppController.j new file mode 100755 index 000000000..1ba92ae56 --- /dev/null +++ b/Tests/Manual/CPTextView/AppController.j @@ -0,0 +1,102 @@ +/* + * AppController.j + * + * Manual test application for the cappuccino text system + * Copyright (C) 2014 Daniel Boehringer + */ + +@import +@import +@import + +@implementation AppController : CPObject +{ + CPTextView _textView; + CPTextView _textView2; +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + // CPLogRegister(CPLogConsole); + + var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], + contentView = [theWindow contentView]; + + [contentView setBackgroundColor:[CPColor colorWithWhite:0.95 alpha:1.0]]; + + _textView = [[CPTextView alloc] initWithFrame:CGRectMake(0,0,500,500)]; + _textView2 = [[CPTextView alloc] initWithFrame:CGRectMake(0,0,500,500)]; + _textView2._isRichText = NO; + [_textView setBackgroundColor:[CPColor whiteColor]]; + [_textView2 setBackgroundColor:[CPColor whiteColor]]; + + var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(20, 20,520,510)]; + var scrollView2 = [[CPScrollView alloc] initWithFrame:CGRectMake(560, 20,520,510)]; + // [scrollView setAutohidesScrollers:YES]; + [scrollView setDocumentView:_textView]; + [scrollView2 setDocumentView:_textView2]; + + [contentView addSubview: scrollView]; + [contentView addSubview: scrollView2]; + + [_textView setDelegate:self]; + + /* build our menu */ + var mainMenu = [CPApp mainMenu]; + + while ([mainMenu numberOfItems] > 0) + [mainMenu removeItemAtIndex:0]; + + var item = [mainMenu insertItemWithTitle:@"Edit" action:nil keyEquivalent:nil atIndex:0], + editMenu = [[CPMenu alloc] initWithTitle:@"Edit Menu"]; + + [_textView2 insertText:"RTF goes here"]; + + [editMenu addItemWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"]; + [editMenu addItemWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]; + [editMenu addItemWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"]; + [editMenu addItemWithTitle:@"Delete" action:@selector(delete:) keyEquivalent:@""]; + [editMenu addItemWithTitle:@"Select All" action:@selector(selectAll:) keyEquivalent:@"a"]; + [editMenu addItemWithTitle:@"Undo" action:@selector(undo:) keyEquivalent:@"z"]; + [editMenu addItemWithTitle:@"Redo" action:@selector(redo:) keyEquivalent:@"Z"]; + + [mainMenu setSubmenu:editMenu forItem:item]; + + item = [mainMenu insertItemWithTitle:@"Font" action:@selector(orderFrontFontPanel:) keyEquivalent:nil atIndex:1]; + item = [mainMenu insertItemWithTitle:@"RTFRoundtrip" action:@selector(makeRTF:) keyEquivalent:nil atIndex:1]; + + var centeredParagraph=[CPParagraphStyle new]; + [centeredParagraph setAlignment: CPCenterTextAlignment]; + [_textView insertText:[[CPAttributedString alloc] initWithString:@"Fusce\n" + attributes:[CPDictionary dictionaryWithObjects:[centeredParagraph, [CPFont boldFontWithName:"Arial" size:18], [CPColor redColor]] + forKeys:[CPParagraphStyleAttributeName, CPFontAttributeName, CPForegroundColorAttributeName]]]]; + + [_textView insertText: [[CPAttributedString alloc] initWithString:@"lectus neque cr as eget lectus neque cr as eget lectus cr as eget lectus" + attributes:[CPDictionary dictionaryWithObjects:[ [CPFont fontWithName:"Arial" size:12]] forKeys: [CPFontAttributeName]]]]; + + [_textView insertText:[[CPAttributedString alloc] initWithString:@" proin, this is text in boldface " + attributes:[CPDictionary dictionaryWithObjects:[ [CPFont boldFontWithName:"Arial" size:12]] forKeys: [CPFontAttributeName]]]]; + [_textView insertText:[[CPAttributedString alloc] initWithString:@"111111 neque cr as eget lectus neque cr as eget lectus cr as eget lectus" + attributes:[CPDictionary dictionaryWithObjects:[ [CPFont fontWithName:"Arial" size:12.0]] forKeys: [CPFontAttributeName]]]]; + + [theWindow orderFront:self]; + [CPMenu setMenuBarVisible:YES]; +} + +//-> CPApplication (?) +- (void)orderFrontFontPanel:sender +{ + [[CPFontManager sharedFontManager] orderFrontFontPanel:self]; +} + +- (void) makeRTF:sender +{ + [_textView2 setString: [RTFProducer produceRTF:[_textView textStorage] documentAttributes: @{}] ]; + var tc = [_RTFParser new]; + var mystr=[tc parseRTF:[_textView2 stringValue]]; + [_textView selectAll: self]; + [_textView insertText: mystr]; + +} + +@end diff --git a/Tests/Manual/CPTextView/Info.plist b/Tests/Manual/CPTextView/Info.plist new file mode 100644 index 000000000..877388578 --- /dev/null +++ b/Tests/Manual/CPTextView/Info.plist @@ -0,0 +1,10 @@ + + + + + Main cib file base name + MainMenu.cib + CPBundleName + CPLevelIndicator + + diff --git a/Tests/Manual/CPTextView/Jakefile b/Tests/Manual/CPTextView/Jakefile new file mode 100644 index 000000000..bd57b7a0d --- /dev/null +++ b/Tests/Manual/CPTextView/Jakefile @@ -0,0 +1,94 @@ +/* + * Jakefile + * CPLevelIndicator + * + * Created by Alexander Ljungberg on May 28, 2011. + * Copyright 2011, WireLoad All rights reserved. + */ + +var ENV = require("system").env, + FILE = require("file"), + JAKE = require("jake"), + task = JAKE.task, + FileList = JAKE.FileList, + app = require("cappuccino/jake").app, + configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", + OS = require("os"); + +app ("CPLevelIndicator", function(task) +{ + task.setBuildIntermediatesPath(FILE.join("Build", "CPLevelIndicator.build", configuration)); + task.setBuildPath(FILE.join("Build", configuration)); + + task.setProductName("CPLevelIndicator"); + task.setIdentifier("com.yourcompany.CPLevelIndicator"); + task.setVersion("1.0"); + task.setAuthor("WireLoad"); + task.setEmail("feedback @nospam@ yourcompany.com"); + task.setSummary("CPLevelIndicator"); + task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**"))); + task.setResources(new FileList("Resources/**")); + task.setIndexFilePath("index.html"); + task.setInfoPlistPath("Info.plist"); + task.setNib2CibFlags("-R Resources/"); + + if (configuration === "Debug") + task.setCompilerFlags("-DDEBUG -g"); + else + task.setCompilerFlags("-O"); +}); + +task ("default", ["CPLevelIndicator"], function() +{ + printResults(configuration); +}); + +task ("build", ["default"]); + +task ("debug", function() +{ + ENV["CONFIGURATION"] = "Debug"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("release", function() +{ + ENV["CONFIGURATION"] = "Release"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("run", ["debug"], function() +{ + OS.system(["open", FILE.join("Build", "Debug", "CPLevelIndicator", "index.html")]); +}); + +task ("run-release", ["release"], function() +{ + OS.system(["open", FILE.join("Build", "Release", "CPLevelIndicator", "index.html")]); +}); + +task ("deploy", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Deployment", "CPLevelIndicator")); + OS.system(["press", "-f", FILE.join("Build", "Release", "CPLevelIndicator"), FILE.join("Build", "Deployment", "CPLevelIndicator")]); + printResults("Deployment") +}); + +task ("desktop", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Desktop", "CPLevelIndicator")); + require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPLevelIndicator"), FILE.join("Build", "Desktop", "CPLevelIndicator", "CPLevelIndicator.app")); + printResults("Desktop") +}); + +task ("run-desktop", ["desktop"], function() +{ + OS.system([FILE.join("Build", "Desktop", "CPLevelIndicator", "CPLevelIndicator.app", "Contents", "MacOS", "NativeHost"), "-i"]); +}); + +function printResults(configuration) +{ + print("----------------------------"); + print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPLevelIndicator")); + print("----------------------------"); +} diff --git a/Tests/Manual/CPTextView/Resources/spinner.gif b/Tests/Manual/CPTextView/Resources/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..a5e705f6cbdf914e5e714c35a8dfef807f19e3c2 GIT binary patch literal 1434 zcmZvbdrVVj7{t$-UNOu86#VHu^|s&3rWfwHBbPG_8{SrlB{Tv1uvvj4t6zP!)#d!Ogc zP^62J^$0+~?-ZcXXpBaq%jFsw8L`=H2?+@R02Yg-*Xw;gACBV^i3CMahr>Z667S!? zk3LDe>VLEsU;sWo$Py~o!gWuaIAnaG3Sv``&tvc+8DJO!| zt4fcbQ8tW}a&xZfgtQ9BnFYLvGG|PvCNlg&uh@Q^w9Pz}+I^hCj`vu9JQADPqdkyk zR40xycD9geUgJu1e;$L`Fpa)?Wl-2&6hO@U*KrPqK(I1H=1h?2fce}6GhhP1oBZC# z1e@gt-qFa6lZrl%s1>bdxg*W)Ebt__O(4sj6(*2X@ciUClwHH#U(NRM7XAjS z+scDZ32J*PCoslsgS~#ZlCCGo`r>S6F)Ghw5wVlqHioFaw?ucD(XoLJ0j;28oPoPV z9A}dR$0SKn>uExfkl#j09o;v$BZ909R=*p{ATNq8BJW;YduX2QMOU7$a$_L5e!G^g zpbkx5G4&FZ%7m14rTN}5YB(;x7$5XOc_hf3E|Hw$TVg)P#qf~}nOn03uqsp>UG>vi zWThIoO)-1Q#@u#O;fMC#WAf@Xj70-0g9YZ;dA$HH1fW1q=9-c>>_yA0S$7M*5?}vi z)8MU`Q%P!7sEBBnd$DrKgFQ2?O%6LpdaC%F8Pn-)EC2t=j~ zoaLamla$FX!GQqWi!%s>sj-#5SJX0IF!TP=r21Z}s)k#btN0?=I7uD9C)Gb$fZ#sm zaVq7g`LwZ%PfNpN^_N-IGLHj@AV`s#4&va7_{Hw63G6BkSGXHdogTZ%QOiRb bDpZ@qYcJKM>x%b%*HX74c8MnqfHi*u-bC?g literal 0 HcmV?d00001 diff --git a/Tests/Manual/CPTextView/index-debug.html b/Tests/Manual/CPTextView/index-debug.html new file mode 100644 index 000000000..1097bcf1b --- /dev/null +++ b/Tests/Manual/CPTextView/index-debug.html @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + CPLevelIndicator + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPTextView/index.html b/Tests/Manual/CPTextView/index.html new file mode 100644 index 000000000..26086f976 --- /dev/null +++ b/Tests/Manual/CPTextView/index.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + CPLevelIndicator + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPTextView/main.j b/Tests/Manual/CPTextView/main.j new file mode 100644 index 000000000..7a956f1f5 --- /dev/null +++ b/Tests/Manual/CPTextView/main.j @@ -0,0 +1,18 @@ +/* + * AppController.j + * CPLevelIndicator + * + * Created by Alexander Ljungberg on May 28, 2011. + * Copyright 2011, WireLoad All rights reserved. + */ + +@import +@import + +@import "AppController.j" + + +function main(args, namedArgs) +{ + CPApplicationMain(args, namedArgs); +}