From 0cbf7b59c4c510410f999f5d39f2a5b82b45b147 Mon Sep 17 00:00:00 2001 From: Shannon Young Date: Fri, 11 Mar 2016 12:59:53 -0800 Subject: [PATCH] Move the two-hand tapping test into Sage RK 1.3 branch --- .../APCAppCore.xcodeproj/project.pbxproj | 12 - APCAppCore/APCAppCore/APCAppCore.h | 1 - .../Categories/ORKOrderedTask+APCHelper.h | 75 ------ .../Categories/ORKOrderedTask+APCHelper.m | 182 --------------- .../ORKOrderedTask+APCHelperTests.m | 218 ------------------ 5 files changed, 488 deletions(-) delete mode 100644 APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.h delete mode 100644 APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.m delete mode 100644 APCAppCore/APCAppCoreTests/ORKOrderedTask+APCHelperTests.m diff --git a/APCAppCore/APCAppCore.xcodeproj/project.pbxproj b/APCAppCore/APCAppCore.xcodeproj/project.pbxproj index dde563f2..d146ae6f 100644 --- a/APCAppCore/APCAppCore.xcodeproj/project.pbxproj +++ b/APCAppCore/APCAppCore.xcodeproj/project.pbxproj @@ -729,7 +729,6 @@ FF44E50E1C1B585900F07DA9 /* APCTaskResultArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = FF44E50C1C1B585900F07DA9 /* APCTaskResultArchiver.m */; }; FF44E51B1C1B94A700F07DA9 /* APCTaskResultArchiverTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FF44E51A1C1B94A700F07DA9 /* APCTaskResultArchiverTests.m */; }; FF9469871C1A2D4000CF7075 /* APCAppCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5179B2919D09128001DCCB7 /* APCAppCore.framework */; }; - FF9469881C1A2F0400CF7075 /* ORKOrderedTask+APCHelperTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FF9469831C1A294E00CF7075 /* ORKOrderedTask+APCHelperTests.m */; }; FF94698A1C1A2F0900CF7075 /* APCScheduleExpressionListSelectorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F129DA1A2F78490015982C /* APCScheduleExpressionListSelectorTests.m */; }; FF94698B1C1A2F0900CF7075 /* APCScheduleExpressionParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F129DD1A2F78490015982C /* APCScheduleExpressionParserTests.m */; }; FF94698C1C1A2F0900CF7075 /* APCScheduleExpressionPointSelectorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F129DC1A2F78490015982C /* APCScheduleExpressionPointSelectorTests.m */; }; @@ -738,8 +737,6 @@ FFB892221C4617BB00CD0081 /* APCDataGroupsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FFB892201C4617BB00CD0081 /* APCDataGroupsManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; FFB892231C4617BB00CD0081 /* APCDataGroupsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FFB892211C4617BB00CD0081 /* APCDataGroupsManager.m */; }; FFB892251C46194E00CD0081 /* APCDataGroupsManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = FFB892241C46194E00CD0081 /* APCDataGroupsManagerTests.m */; }; - FFF698DD1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FFF698DB1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FFF698DE1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FFF698DC1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.m */; }; FFFA23A91C20A4D800727DA8 /* FilenameTranslation_test.json in Resources */ = {isa = PBXBuildFile; fileRef = FFFA23A81C20A4D800727DA8 /* FilenameTranslation_test.json */; }; /* End PBXBuildFile section */ @@ -1492,12 +1489,9 @@ FF44E50B1C1B585900F07DA9 /* APCTaskResultArchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APCTaskResultArchiver.h; sourceTree = ""; }; FF44E50C1C1B585900F07DA9 /* APCTaskResultArchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCTaskResultArchiver.m; sourceTree = ""; }; FF44E51A1C1B94A700F07DA9 /* APCTaskResultArchiverTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCTaskResultArchiverTests.m; sourceTree = ""; }; - FF9469831C1A294E00CF7075 /* ORKOrderedTask+APCHelperTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ORKOrderedTask+APCHelperTests.m"; sourceTree = ""; }; FFB892201C4617BB00CD0081 /* APCDataGroupsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APCDataGroupsManager.h; sourceTree = ""; }; FFB892211C4617BB00CD0081 /* APCDataGroupsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCDataGroupsManager.m; sourceTree = ""; }; FFB892241C46194E00CD0081 /* APCDataGroupsManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APCDataGroupsManagerTests.m; sourceTree = ""; }; - FFF698DB1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ORKOrderedTask+APCHelper.h"; sourceTree = ""; }; - FFF698DC1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ORKOrderedTask+APCHelper.m"; sourceTree = ""; }; FFFA23A81C20A4D800727DA8 /* FilenameTranslation_test.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = FilenameTranslation_test.json; sourceTree = ""; }; /* End PBXFileReference section */ @@ -2431,8 +2425,6 @@ 36B7D2541A8D848D0043F968 /* ORKAnswerFormat+Helper.m */, 6C6AA33E1B55EA6C0056AD47 /* ORKFileResult+Filename.h */, 6C6AA33F1B55EA6C0056AD47 /* ORKFileResult+Filename.m */, - FFF698DB1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.h */, - FFF698DC1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.m */, F5306CCB1A8BE7F600732E60 /* ORKQuestionResult+APCHelper.h */, F5306CCC1A8BE7F600732E60 /* ORKQuestionResult+APCHelper.m */, F5B9475A1A73272C0034C522 /* UIAlertController+Helper.h */, @@ -3110,7 +3102,6 @@ FF9469821C1A28E800CF7075 /* ActivityTests */ = { isa = PBXGroup; children = ( - FF9469831C1A294E00CF7075 /* ORKOrderedTask+APCHelperTests.m */, FF44E51A1C1B94A700F07DA9 /* APCTaskResultArchiverTests.m */, ); name = ActivityTests; @@ -3149,7 +3140,6 @@ CFFDED7A1A95731F00B25581 /* APCMedicationTrackerMedicationsDisplayView.h in Headers */, F5F12AB21A2F78490015982C /* APCSignupPasscodeViewController.h in Headers */, F5B947C91A73272C0034C522 /* NSString+Helper.h in Headers */, - FFF698DD1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.h in Headers */, F5B947BF1A73272C0034C522 /* NSDateComponents+Helper.h in Headers */, 5B0601CD1AE79B50009D6D65 /* APCFeedTableViewCell.h in Headers */, 5B9B36AB1A95DC1700389F42 /* APCActivitiesTableViewCell.h in Headers */, @@ -3680,7 +3670,6 @@ 5B0432A01A318AA2000DC9ED /* APCSignInTask.m in Sources */, F5F12A0F1A2F78490015982C /* APCUser+UserData.m in Sources */, F5F12AC11A2F78490015982C /* APCGraphViewController.m in Sources */, - FFF698DE1C18B9E200DC56CC /* ORKOrderedTask+APCHelper.m in Sources */, 5B534ED51B2179550049C6AB /* APCNewsFeedManager.m in Sources */, 7B558D291AE587DF00129167 /* CLLocation+APCAdditions.m in Sources */, 5BD6EBA31A9A46BB00C3BFB0 /* APCStudyLandingCollectionViewCell.m in Sources */, @@ -3951,7 +3940,6 @@ FF44E51B1C1B94A700F07DA9 /* APCTaskResultArchiverTests.m in Sources */, FF94698A1C1A2F0900CF7075 /* APCScheduleExpressionListSelectorTests.m in Sources */, CBC2593B1C5838940091308E /* APCScheduleExpressionEnumeratorTests.m in Sources */, - FF9469881C1A2F0400CF7075 /* ORKOrderedTask+APCHelperTests.m in Sources */, 803237A61C6E8A6E00208365 /* APCFudgeTestsToKnowAboutSwiftByAddingASwiftTestCase.swift in Sources */, 0833AE1E1A76C016001D8AA0 /* (null) in Sources */, CBD5DBF61C5806AD00AD654E /* APCTasksReminderManagerTests.m in Sources */, diff --git a/APCAppCore/APCAppCore/APCAppCore.h b/APCAppCore/APCAppCore/APCAppCore.h index d659d395..7d8c7fa9 100644 --- a/APCAppCore/APCAppCore/APCAppCore.h +++ b/APCAppCore/APCAppCore/APCAppCore.h @@ -325,7 +325,6 @@ FOUNDATION_EXPORT const unsigned char APCAppCoreVersionString[]; #import #import #import -#import #import #import #import diff --git a/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.h b/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.h deleted file mode 100644 index 954e86a0..00000000 --- a/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// ORKOrderedTask+APCHelper.h -// APCAppCore -// -// Copyright (c) 2015 Apple, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation and/or -// other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder(s) nor the names of any contributors -// may be used to endorse or promote products derived from this software without -// specific prior written permission. No license is granted to the trademarks of -// the copyright holders even if such marks are included in this software. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const APCTapInstructionStepIdentifier; -extern NSString *const APCTapTappingStepIdentifier; -extern NSString *const APCRightHandIdentifier; -extern NSString *const APCLeftHandIdentifier; - -@interface ORKOrderedTask (APCHelper) - -/** - Returns a predefined task that consists of two finger tapping. - - In a two finger tapping task, the participant is asked to rhythmically and alternately tap two - targets on the device screen. - - A two finger tapping task can be used to assess basic motor capabilities including speed, accuracy, - and rhythm. - - Data collected in this task includes touch activity and accelerometer information. - - @param identifier The task identifier to use for this task, appropriate to the study. - @param intendedUseDescription A localized string describing the intended use of the data - collected. If the value of this parameter is `nil`, the default - localized text will be displayed. - @param duration The length of the count down timer that runs while touch data is - collected. - @param options Options that affect the features of the predefined task. - @param handOptions Options for determining which hand(s) to test. - - @return An active two finger tapping task that can be presented with an `ORKTaskViewController` object. - */ -+ (ORKOrderedTask *)twoFingerTappingIntervalTaskWithIdentifier:(NSString *)identifier - intendedUseDescription:(nullable NSString *)intendedUseDescription - duration:(NSTimeInterval)duration - options:(ORKPredefinedTaskOption)options - handOptions:(ORKPredefinedTaskHandOption)handOptions; - -@end - -NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.m b/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.m deleted file mode 100644 index 561e3dc7..00000000 --- a/APCAppCore/APCAppCore/Library/Categories/ORKOrderedTask+APCHelper.m +++ /dev/null @@ -1,182 +0,0 @@ -// -// ORKOrderedTask+APCHelper.m -// APCAppCore -// -// Copyright (c) 2015 Apple, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation and/or -// other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder(s) nor the names of any contributors -// may be used to endorse or promote products derived from this software without -// specific prior written permission. No license is granted to the trademarks of -// the copyright holders even if such marks are included in this software. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -#import "ORKOrderedTask+APCHelper.h" -#import "APCLocalization.h" -#import "UIImage+APCHelper.h" - -NSString *const APCTapInstructionStepIdentifier = @"tappingInstruction"; -NSString *const APCTapTappingStepIdentifier = @"tapping"; -NSString *const APCRightHandIdentifier = @"right"; -NSString *const APCLeftHandIdentifier = @"left"; - -@implementation ORKOrderedTask (APCHelper) - -+ (ORKOrderedTask *)twoFingerTappingIntervalTaskWithIdentifier:(NSString *)identifier - intendedUseDescription:(NSString *)intendedUseDescription - duration:(NSTimeInterval)duration - options:(ORKPredefinedTaskOption)options - handOptions:(ORKPredefinedTaskHandOption)handOptions -{ - ORKOrderedTask *orkTask = [self twoFingerTappingIntervalTaskWithIdentifier:identifier - intendedUseDescription:intendedUseDescription - duration:duration - options:options]; - if (handOptions == ORKPredefinedTaskHandOptionUndefined) { - return orkTask; - } - - // Create mutable copy of the steps - NSMutableArray *steps = [orkTask.steps mutableCopy]; - - // Look for the tapping instrution step - const NSUInteger tappingInstructionIdx = 1; - ORKInstructionStep *tappingInstructionStep = nil; - if ((orkTask.steps.count > tappingInstructionIdx) && - [orkTask.steps[tappingInstructionIdx] isKindOfClass:[ORKInstructionStep class]]) - { - tappingInstructionStep = (ORKInstructionStep *)orkTask.steps[tappingInstructionIdx]; - tappingInstructionStep.detailText = NSLocalizedStringWithDefaultValue(@"Tapping Instruction Step Detail Text", @"APCAppCore", APCBundle(), - @"Tap the Next button to begin.", - @"Tap the Next button to begin."); - [steps removeObject:tappingInstructionStep]; - } - - // Look for a tapping activity step - ORKActiveStep *tappingStep = nil; - NSUInteger tappingIdx = NSNotFound; - for (NSUInteger idx=1; idx < steps.count && tappingIdx == NSNotFound; idx++) - { - if ([steps[idx] isKindOfClass:[ORKActiveStep class]]) { - tappingStep = steps[idx]; - tappingIdx = idx; - } - } - - // If either the instruction step or the tapping activity step is not found - // then this is no longer pointing at a valid version of ResearchKit and needs to be fixed - if ((tappingIdx == NSNotFound) || (tappingInstructionStep == nil)) - { - NSAssert(tappingIdx != NSNotFound, @"Could not find tapping activity"); - NSAssert(tappingInstructionStep != nil, @"Could not find tapping instruction"); - return orkTask; - } - - // Remove the existing tapping step - [steps removeObjectAtIndex:tappingIdx]; - - // Setup which hand to start with and how many hands to add based on the handOptions parameter - // Hand order is randomly determined. - NSUInteger handCount = ((handOptions & ORKPredefinedTaskHandOptionBoth) == ORKPredefinedTaskHandOptionBoth) ? 2 : 1; - BOOL rightHand; - switch (handOptions) { - case ORKPredefinedTaskHandOptionLeft: - rightHand = NO; break; - case ORKPredefinedTaskHandOptionRight: - rightHand = YES; break; - default: - rightHand = (arc4random()%2 == 0); break; - } - - for (NSUInteger hand=1; hand <= handCount; hand++) - { - // Copy steps to duplicate for both right and left hands - NSString *handIdentifier = rightHand ? APCRightHandIdentifier : APCLeftHandIdentifier; - ORKInstructionStep *instructionStep = [tappingInstructionStep copyWithIdentifier:[NSString stringWithFormat:@"%@.%@", APCTapInstructionStepIdentifier, handIdentifier]]; - ORKActiveStep *activeStep = [tappingStep copyWithIdentifier:[NSString stringWithFormat:@"%@.%@", APCTapTappingStepIdentifier, handIdentifier]]; - activeStep.optional = YES; - - // Set instructions and image for right/left hands - if (rightHand) { - instructionStep.title = NSLocalizedStringWithDefaultValue(@"Right Hand", @"APCAppCore", APCBundle(), @"Right Hand", @"Title for instruction step for right hand."); - activeStep.title = NSLocalizedStringWithDefaultValue(@"Right Hand Tap Step Title", @"APCAppCore", APCBundle(), - @"Tap the buttons using your RIGHT hand.", - @"Tapping activity instructions explicitly calling out using the right hand."); - } - else { - instructionStep.title = NSLocalizedStringWithDefaultValue(@"Left Hand", @"APCAppCore", APCBundle(), @"Left Hand", @"Title for instruction step for left hand."); - activeStep.title = NSLocalizedStringWithDefaultValue(@"Left Hand Tap Step Title", @"APCAppCore", APCBundle(), - @"Tap the buttons using your LEFT hand.", - @"Tapping activity instructions explicitly calling out using the left hand."); - instructionStep.image = [instructionStep.image flippedImage:UIImageOrientationUpMirrored]; - } - - // Update the instructions for the tapping test screen that is displayed prior to each hand test - NSString *restText = NSLocalizedStringWithDefaultValue(@"Instructions Flat Surface", @"APCAppCore", APCBundle(), - @"Rest your phone on a flat surface.", - @"Instruction to rest phone on a flat surface before beginning test."); - NSString *durationString = [APCDurationStringFormatter() stringFromTimeInterval:duration]; - NSString *tappingTextFormat = NSLocalizedStringWithDefaultValue(@"Instructions Tap Consistently", @"APCAppCore", APCBundle(), - @"Keep tapping for %@ and time your taps to be as consistent as possible.", - @"Instruction to tap consistentently for a given period of time defined by %@"); - NSString *tappingText = [NSString stringWithFormat:tappingTextFormat, durationString]; - NSString *handText = nil; - - if (hand == 1) { - if (rightHand) { - handText = NSLocalizedStringWithDefaultValue(@"Right Hand Tap Instructions", @"APCAppCore", APCBundle(), - @"Then use two fingers on your right hand to alternately tap the buttons that appear.", - @"Instructions for the tapping test with the right hand."); - } - else { - handText = NSLocalizedStringWithDefaultValue(@"Left Hand Tap Instructions", @"APCAppCore", APCBundle(), - @"Then use two fingers on your left hand to alternately tap the buttons that appear.", - @"Instructions for the tapping test with the left hand."); - } - } - else { - if (rightHand) { - handText = NSLocalizedStringWithDefaultValue(@"Right Hand Repeat Instructions", @"APCAppCore", APCBundle(), - @"Now repeat the same test using your right hand.", - @"Instructions for repeating the tapping test with the right hand."); - } - else { - handText = NSLocalizedStringWithDefaultValue(@"Left Hand Repeat Instructions", @"APCAppCore", APCBundle(), - @"Now repeat the same test using your left hand.", - @"Instructions for repeating the tapping test with the left hand."); - } - } - instructionStep.text = [NSString stringWithFormat:@"%@ %@ %@", restText, handText, tappingText]; - - // Insert the instruction step and tapping activity step - [steps insertObject:instructionStep atIndex:tappingIdx++]; - [steps insertObject:activeStep atIndex:tappingIdx++]; - - // Flip to the other hand (ignored if handCount == 1) - rightHand = !rightHand; - } - - return [[ORKOrderedTask alloc] initWithIdentifier:identifier steps:steps]; -} - -@end diff --git a/APCAppCore/APCAppCoreTests/ORKOrderedTask+APCHelperTests.m b/APCAppCore/APCAppCoreTests/ORKOrderedTask+APCHelperTests.m deleted file mode 100644 index 1a64ac7c..00000000 --- a/APCAppCore/APCAppCoreTests/ORKOrderedTask+APCHelperTests.m +++ /dev/null @@ -1,218 +0,0 @@ -// -// ORKOrderedTask+APCHelperTests.m -// APCAppCore -// -// Copyright (c) 2015 Apple, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation and/or -// other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder(s) nor the names of any contributors -// may be used to endorse or promote products derived from this software without -// specific prior written permission. No license is granted to the trademarks of -// the copyright holders even if such marks are included in this software. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -#import -#import - -@interface ORKOrderedTask_APCHelperTests : XCTestCase - -@end - -@implementation ORKOrderedTask_APCHelperTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testTwoFingerTappingIntervalTaskWithIdentifier_TapHandOptionUndefined { - - ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" - intendedUseDescription:nil - duration:10 - options:0 - handOptions:0]; - - for (ORKStep *step in task.steps) { - XCTAssertFalse([step.identifier.lowercaseString containsString:@"left"]); - XCTAssertFalse([step.identifier.lowercaseString containsString:@"right"]); - XCTAssertFalse([step.title.lowercaseString containsString:@"right"]); - XCTAssertFalse([step.title.lowercaseString containsString:@"left"]); - XCTAssertFalse([step.text.lowercaseString containsString:@"right"]); - XCTAssertFalse([step.text.lowercaseString containsString:@"left"]); - } -} - -- (void)testTwoFingerTappingIntervalTaskWithIdentifier_TapHandOptionLeft { - - ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" - intendedUseDescription:nil - duration:10 - options:0 - handOptions:ORKPredefinedTaskHandOptionLeft]; - // Check assumption around how many steps - XCTAssertEqual(task.steps.count, 4); - - // Check that none of the language or identifiers contain the word "right" - for (ORKStep *step in task.steps) { - XCTAssertFalse([step.identifier.lowercaseString hasSuffix:APCRightHandIdentifier]); - XCTAssertFalse([step.title.lowercaseString containsString:@"right"]); - XCTAssertFalse([step.text.lowercaseString containsString:@"right"]); - } - - NSArray * (^filteredSteps)(NSString*, NSString*) = ^(NSString *part1, NSString *part2) { - NSString *keyValue = [NSString stringWithFormat:@"%@.%@", part1, part2]; - NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K == %@", NSStringFromSelector(@selector(identifier)), keyValue]; - return [task.steps filteredArrayUsingPredicate:predicate]; - }; - - // Look for instruction step - NSArray *instructions = filteredSteps(APCTapInstructionStepIdentifier, APCLeftHandIdentifier); - XCTAssertEqual(instructions.count, 1); - ORKStep *instructionStep = [instructions firstObject]; - XCTAssertEqualObjects(instructionStep.title, @"Left Hand"); - XCTAssertEqualObjects(instructionStep.text, @"Rest your phone on a flat surface. Then use two fingers on your left hand to alternately tap the buttons that appear. Keep tapping for 10 seconds and time your taps to be as consistent as possible."); - - // Look for the activity step - NSArray *tappings = filteredSteps(APCTapTappingStepIdentifier, APCLeftHandIdentifier); - XCTAssertEqual(tappings.count, 1); - ORKStep *tappingStep = [tappings firstObject]; - XCTAssertEqualObjects(tappingStep.title, @"Tap the buttons using your LEFT hand."); - -} - -- (void)testTwoFingerTappingIntervalTaskWithIdentifier_TapHandOptionRight { - - ORKOrderedTask *task = [ORKOrderedTask twoFingerTappingIntervalTaskWithIdentifier:@"test" - intendedUseDescription:nil - duration:10 - options:0 - handOptions:ORKPredefinedTaskHandOptionRight]; - // Check assumption around how many steps - XCTAssertEqual(task.steps.count, 4); - - // Check that none of the language or identifiers contain the word "right" - for (ORKStep *step in task.steps) { - XCTAssertFalse([step.identifier.lowercaseString hasSuffix:APCLeftHandIdentifier]); - XCTAssertFalse([step.title.lowercaseString containsString:@"left"]); - XCTAssertFalse([step.text.lowercaseString containsString:@"left"]); - } - - NSArray * (^filteredSteps)(NSString*, NSString*) = ^(NSString *part1, NSString *part2) { - NSString *keyValue = [NSString stringWithFormat:@"%@.%@", part1, part2]; - NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K == %@", NSStringFromSelector(@selector(identifier)), keyValue]; - return [task.steps filteredArrayUsingPredicate:predicate]; - }; - - // Look for instruction step - NSArray *instructions = filteredSteps(APCTapInstructionStepIdentifier, APCRightHandIdentifier); - XCTAssertEqual(instructions.count, 1); - ORKStep *instructionStep = [instructions firstObject]; - XCTAssertEqualObjects(instructionStep.title, @"Right Hand"); - XCTAssertEqualObjects(instructionStep.text, @"Rest your phone on a flat surface. Then use two fingers on your right hand to alternately tap the buttons that appear. Keep tapping for 10 seconds and time your taps to be as consistent as possible."); - - // Look for the activity step - NSArray *tappings = filteredSteps(APCTapTappingStepIdentifier, APCRightHandIdentifier); - XCTAssertEqual(tappings.count, 1); - ORKStep *tappingStep = [tappings firstObject]; - XCTAssertEqualObjects(tappingStep.title, @"Tap the buttons using your RIGHT hand."); - -} - -- (void)testTwoFingerTappingIntervalTaskWithIdentifier_TapHandOptionBoth -{ - NSUInteger leftCount = 0; - NSUInteger rightCount = 0; - NSUInteger totalCount = 100; - NSUInteger threshold = 35; - - for (int ii=0; ii