Skip to content

Commit

Permalink
Test default actions for applications and text objects
Browse files Browse the repository at this point in the history
  • Loading branch information
n8henrie committed Sep 19, 2023
1 parent ea23482 commit 72a2ef6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Quicksilver/Quicksilver Tests/Quicksilver_Tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ - (void)testActionsForURLObject {
XCTAssertTrue([[actions[0] identifier] isEqualToString:@"URLOpenAction"]);
}

- (void)testActionsForApplicationObject {
// Applications should be recognized as file paths and have a default action
// of "Open"
NSString *app = @"/System/Applications/Calendar.app";
QSObject *object = [QSObject objectWithString:app];
XCTAssertTrue([object containsType:QSFilePathType] && [[object primaryType] isEqualToString:QSFilePathType], @"'%@' was not recognized as a file path", app);
NSArray *actions = [[QSExecutor sharedInstance] rankedActionsForDirectObject:object indirectObject:nil];
XCTAssertTrue([actions count] > 0);
XCTAssertTrue([[actions[0] identifier] isEqualToString:@"FileOpenAction"]);
}

- (void)testActionsForTextObject {
// Text objects should be recognized as file paths and have a default action
// of "Open"
NSString *text = @"this is a test string";
QSObject *object = [QSObject objectWithString:text];
XCTAssertTrue([object containsType:QSTextType] && [[object primaryType] isEqualToString:QSTextType], @"'%@' was not recognized as text", text);
NSArray *actions = [[QSExecutor sharedInstance] rankedActionsForDirectObject:object indirectObject:nil];
XCTAssertTrue([actions count] > 0);
XCTAssertTrue([[actions[0] identifier] isEqualToString:@"QSLargeTypeAction"]);
}

// Attempted check for #2913. The real issue is with QSLibrarion's objectDictionary temporarily being wiped during `reloadSets`. There should be a check to make sure that doesn't happen
- (void)testRightArrowIntoSynonym {
// code copied from QSUserDefinedProxySource
Expand Down

0 comments on commit 72a2ef6

Please sign in to comment.