[sword-svn] r3265 - in trunk/bindings/objc: ObjCSword.xcodeproj src test

mdbergmann at crosswire.org mdbergmann at crosswire.org
Wed Oct 8 06:44:48 MST 2014


Author: mdbergmann
Date: 2014-10-08 06:44:48 -0700 (Wed, 08 Oct 2014)
New Revision: 3265

Modified:
   trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
   trunk/bindings/objc/src/SwordManager.mm
   trunk/bindings/objc/src/SwordModule.mm
   trunk/bindings/objc/test/SwordModuleTest.m
Log:
more tests and test fixes.
still problems with headings/introductions.

Modified: trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj
===================================================================
--- trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj	2014-10-06 14:18:19 UTC (rev 3264)
+++ trunk/bindings/objc/ObjCSword.xcodeproj/project.pbxproj	2014-10-08 13:44:48 UTC (rev 3265)
@@ -1372,6 +1372,8 @@
 		A9D4360511C4FE97007AFE83 /* SwordModule+Index.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D4360311C4FE97007AFE83 /* SwordModule+Index.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		A9D4360611C4FE97007AFE83 /* SwordModule+Index.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9D4360411C4FE97007AFE83 /* SwordModule+Index.mm */; };
 		A9D4382311C52947007AFE83 /* locales.d in Resources */ = {isa = PBXBuildFile; fileRef = A9D437CE11C52947007AFE83 /* locales.d */; };
+		A9D8FD3319E2EC5B0055700C /* libsword.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A954ABC313EE9AB00094E3FE /* libsword.dylib */; };
+		A9D8FD3819E2EC730055700C /* introtest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9D8FD2C19E2EC0E0055700C /* introtest.cpp */; };
 		A9D9FA0B13EEE5CF00EA9DEB /* libsword.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = A954ABC313EE9AB00094E3FE /* libsword.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
 		A9EE8A9119E286E500CFFE6A /* ObjCSword.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ObjCSword.framework */; };
 		A9EE8A9719E2877500CFFE6A /* SwordModuleLongRunTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9BDFA7B1207FA2F0067ED5B /* SwordModuleLongRunTest.mm */; };
@@ -1625,6 +1627,13 @@
 			remoteGlobalIDString = A9D271ED14D718F500DA8926;
 			remoteInfo = xml2gbs;
 		};
+		A9D8FD2F19E2EC5B0055700C /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = A954ABC213EE9AB00094E3FE;
+			remoteInfo = sword;
+		};
 		A9EE8A9219E286E500CFFE6A /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -3137,6 +3146,8 @@
 		A9D4360311C4FE97007AFE83 /* SwordModule+Index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "SwordModule+Index.h"; path = "src/SwordModule+Index.h"; sourceTree = "<group>"; };
 		A9D4360411C4FE97007AFE83 /* SwordModule+Index.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "SwordModule+Index.mm"; path = "src/SwordModule+Index.mm"; sourceTree = "<group>"; };
 		A9D437CE11C52947007AFE83 /* locales.d */ = {isa = PBXFileReference; lastKnownFileType = folder; name = locales.d; path = ../../locales.d; sourceTree = SOURCE_ROOT; };
+		A9D8FD2C19E2EC0E0055700C /* introtest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introtest.cpp; path = ../../tests/introtest.cpp; sourceTree = "<group>"; };
+		A9D8FD3719E2EC5B0055700C /* introtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = introtest; sourceTree = BUILT_PRODUCTS_DIR; };
 		A9E9C5ED16806A2B00ECEB39 /* teixhtml.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = teixhtml.cpp; sourceTree = "<group>"; };
 		A9EE8A8B19E286E500CFFE6A /* LongRunningTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LongRunningTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
 		A9EE8A8E19E286E500CFFE6A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -3303,6 +3314,14 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A9D8FD3219E2EC5B0055700C /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A9D8FD3319E2EC5B0055700C /* libsword.dylib in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		A9EE8A8819E286E500CFFE6A /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
@@ -3338,6 +3357,7 @@
 				A9D271EA14D718DF00DA8926 /* vs2osisreftxt */,
 				A9D271F714D718F500DA8926 /* xml2gbs */,
 				A9EE8A8B19E286E500CFFE6A /* LongRunningTests.xctest */,
+				A9D8FD3719E2EC5B0055700C /* introtest */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -3347,6 +3367,7 @@
 			children = (
 				A954A7EB13EE96FC0094E3FE /* Sword */,
 				A975ECD211C7925B007C1532 /* Utilities */,
+				A9D8FD2B19E2EBD80055700C /* Samples */,
 				A94EAE72117B32AF0018B06F /* Services */,
 				08FB77AEFE84172EC02AAC07 /* SwordWrapper */,
 				32C88DFF0371C24200C91783 /* Other Sources */,
@@ -5333,6 +5354,14 @@
 			path = test;
 			sourceTree = "<group>";
 		};
+		A9D8FD2B19E2EBD80055700C /* Samples */ = {
+			isa = PBXGroup;
+			children = (
+				A9D8FD2C19E2EC0E0055700C /* introtest.cpp */,
+			);
+			name = Samples;
+			sourceTree = "<group>";
+		};
 		A9EE8A8C19E286E500CFFE6A /* LongRunningTests */ = {
 			isa = PBXGroup;
 			children = (
@@ -6236,6 +6265,23 @@
 			productReference = A9D271F714D718F500DA8926 /* xml2gbs */;
 			productType = "com.apple.product-type.tool";
 		};
+		A9D8FD2D19E2EC5B0055700C /* introtest */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = A9D8FD3419E2EC5B0055700C /* Build configuration list for PBXNativeTarget "introtest" */;
+			buildPhases = (
+				A9D8FD3019E2EC5B0055700C /* Sources */,
+				A9D8FD3219E2EC5B0055700C /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				A9D8FD2E19E2EC5B0055700C /* PBXTargetDependency */,
+			);
+			name = introtest;
+			productName = mod2osis;
+			productReference = A9D8FD3719E2EC5B0055700C /* introtest */;
+			productType = "com.apple.product-type.tool";
+		};
 		A9EE8A8A19E286E500CFFE6A /* LongRunningTests */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = A9EE8A9419E286E500CFFE6A /* Build configuration list for PBXNativeTarget "LongRunningTests" */;
@@ -6306,6 +6352,7 @@
 				A9D271E014D718DF00DA8926 /* vs2osisreftxt */,
 				A9D271ED14D718F500DA8926 /* xml2gbs */,
 				A9D271FA14D7193300DA8926 /* Utilities */,
+				A9D8FD2D19E2EC5B0055700C /* introtest */,
 			);
 		};
 /* End PBXProject section */
@@ -7261,6 +7308,14 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A9D8FD3019E2EC5B0055700C /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A9D8FD3819E2EC730055700C /* introtest.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		A9EE8A8719E286E500CFFE6A /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
@@ -7447,6 +7502,11 @@
 			target = A9D271ED14D718F500DA8926 /* xml2gbs */;
 			targetProxy = A9D2721E14D7194E00DA8926 /* PBXContainerItemProxy */;
 		};
+		A9D8FD2E19E2EC5B0055700C /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = A954ABC213EE9AB00094E3FE /* sword */;
+			targetProxy = A9D8FD2F19E2EC5B0055700C /* PBXContainerItemProxy */;
+		};
 		A9EE8A9319E286E500CFFE6A /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
 			target = 8DC2EF4F0486A6940098B216 /* ObjCSword */;
@@ -8988,6 +9048,80 @@
 			};
 			name = Release;
 		};
+		A9D8FD3519E2EC5B0055700C /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CODE_SIGN_IDENTITY = "Developer ID Application: Manfred Bergmann";
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				HEADER_SEARCH_PATHS = (
+					"$(SRCROOT)/../../include",
+					"$(SRCROOT)/dependencies/icu/source/i18n",
+					"$(SRCROOT)/dependencies/icu/source/common",
+					"$(SRCROOT)/dependencies/icu/source/io",
+					"$(SRCROOT)/dependencies/clucene",
+				);
+				INSTALL_PATH = /usr/local/bin;
+				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Frameworks/ObjCSword.framework/Versions/A/Frameworks";
+				OTHER_CFLAGS = (
+					"-DCURLAVAILABLE",
+					"-Dunix",
+					"-D__unix__",
+					"-DEXCLUDEXZ",
+					"-D_ICU_",
+				);
+				OTHER_LDFLAGS = (
+					"-lcurl",
+					"-lz",
+					"-licucore",
+				);
+				PRODUCT_NAME = introtest;
+				SDKROOT = macosx;
+				STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
+				VALID_ARCHS = x86_64;
+			};
+			name = Debug;
+		};
+		A9D8FD3619E2EC5B0055700C /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CODE_SIGN_IDENTITY = "Developer ID Application: Manfred Bergmann";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_MODEL_TUNING = G5;
+				HEADER_SEARCH_PATHS = (
+					"$(SRCROOT)/../../include",
+					"$(SRCROOT)/dependencies/icu/source/i18n",
+					"$(SRCROOT)/dependencies/icu/source/common",
+					"$(SRCROOT)/dependencies/icu/source/io",
+					"$(SRCROOT)/dependencies/clucene",
+				);
+				INSTALL_PATH = /usr/local/bin;
+				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../../Frameworks/ObjCSword.framework/Versions/A/Frameworks";
+				OTHER_CFLAGS = (
+					"-DCURLAVAILABLE",
+					"-Dunix",
+					"-D__unix__",
+					"-DEXCLUDEXZ",
+					"-D_ICU_",
+				);
+				OTHER_LDFLAGS = (
+					"-lcurl",
+					"-lz",
+					"-licucore",
+				);
+				PRODUCT_NAME = introtest;
+				SDKROOT = macosx;
+				STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
+				VALID_ARCHS = x86_64;
+				ZERO_LINK = NO;
+			};
+			name = Release;
+		};
 		A9EE8A9519E286E500CFFE6A /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
@@ -9274,6 +9408,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		A9D8FD3419E2EC5B0055700C /* Build configuration list for PBXNativeTarget "introtest" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A9D8FD3519E2EC5B0055700C /* Debug */,
+				A9D8FD3619E2EC5B0055700C /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 		A9EE8A9419E286E500CFFE6A /* Build configuration list for PBXNativeTarget "LongRunningTests" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
@@ -9281,6 +9424,7 @@
 				A9EE8A9619E286E500CFFE6A /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
 		};
 /* End XCConfigurationList section */
 	};

Modified: trunk/bindings/objc/src/SwordManager.mm
===================================================================
--- trunk/bindings/objc/src/SwordManager.mm	2014-10-06 14:18:19 UTC (rev 3264)
+++ trunk/bindings/objc/src/SwordManager.mm	2014-10-08 13:44:48 UTC (rev 3265)
@@ -13,11 +13,8 @@
 
 #import <ObjCSword/ObjCSword.h>
 #import "Notifications.h"
-#import "FilterProviderFactory.h"
-#import "DefaultFilterProvider.h"
 
 #include "encfiltmgr.h"
-#import "SwordFilter.h"
 
 using std::string;
 using std::list;
@@ -46,7 +43,7 @@
 
             ModuleType aType = [SwordModule moduleTypeForModuleTypeString:type];
             SwordModule *sm = [SwordModule moduleForType:aType swModule:mod swordManager:self];
-            [dict setObject:sm forKey:[[sm name] lowercaseString]];
+            dict[[[sm name] lowercaseString]] = sm;
 
             [self addFiltersToModule:sm];
         }
@@ -124,11 +121,7 @@
 # pragma mark - class methods
 
 + (NSArray *)moduleTypes {
-    return [NSArray arrayWithObjects:
-            SWMOD_TYPES_BIBLES, 
-            SWMOD_TYPES_COMMENTARIES,
-            SWMOD_TYPES_DICTIONARIES,
-            SWMOD_TYPES_GENBOOKS, nil];
+    return @[SWMOD_TYPES_BIBLES, SWMOD_TYPES_COMMENTARIES, SWMOD_TYPES_DICTIONARIES, SWMOD_TYPES_GENBOOKS];
 }
 
 + (SwordManager *)managerWithPath:(NSString *)path {
@@ -155,7 +148,7 @@
         self.modulesPath = path;
 
 		self.modules = [NSDictionary dictionary];
-		self.managerLock = (NSLock *)[[NSRecursiveLock alloc] init];
+		self.managerLock = (id) [[NSRecursiveLock alloc] init];
 
         [self reInit];
         
@@ -163,7 +156,7 @@
         sword::StringList::iterator	it;
         for(it = options.begin(); it != options.end(); it++) {
             [self setGlobalOption:[NSString stringWithCString:it->c_str() encoding:NSUTF8StringEncoding] value:SW_OFF];
-        }        
+        }
     }	
 	
 	return self;
@@ -177,7 +170,7 @@
         temporaryManager = YES;
         
 		self.modules = [NSDictionary dictionary];
-        self.managerLock = (NSLock *)[[NSRecursiveLock alloc] init];
+        self.managerLock = (id) [[NSRecursiveLock alloc] init];
         
 		[self refreshModules];
     }

Modified: trunk/bindings/objc/src/SwordModule.mm
===================================================================
--- trunk/bindings/objc/src/SwordModule.mm	2014-10-06 14:18:19 UTC (rev 3264)
+++ trunk/bindings/objc/src/SwordModule.mm	2014-10-08 13:44:48 UTC (rev 3265)
@@ -18,9 +18,6 @@
 #import "SwordVerseKey.h"
 #import "SwordBible.h"
 #import "SwordCommentary.h"
-#import "SwordDictionary.h"
-#import "SwordBook.h"
-#import "SwordFilter.h"
 
 @interface SwordModule ()
 
@@ -191,7 +188,7 @@
 }
 
 - (NSInteger)error {
-    return swModule->Error();
+    return swModule->popError();
 }
 
 - (NSString *)retrieveName {
@@ -227,11 +224,11 @@
 }
 
 - (NSString *)categoryString {
-    NSString *cat = [configEntries objectForKey:SWMOD_CONFENTRY_CATEGORY];
+    NSString *cat = configEntries[SWMOD_CONFENTRY_CATEGORY];
     if(cat == nil) {
         cat = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_CATEGORY];
         if(cat != nil) {
-            [configEntries setObject:cat forKey:SWMOD_CONFENTRY_CATEGORY];
+            configEntries[SWMOD_CONFENTRY_CATEGORY] = cat;
         }
     }
     
@@ -246,11 +243,11 @@
 }
 
 - (NSString *)cipherKey {
-    NSString *cipherKey = [configEntries objectForKey:SWMOD_CONFENTRY_CIPHERKEY];
+    NSString *cipherKey = configEntries[SWMOD_CONFENTRY_CIPHERKEY];
     if(cipherKey == nil) {
         cipherKey = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_CIPHERKEY];
         if(cipherKey != nil) {
-            [configEntries setObject:cipherKey forKey:SWMOD_CONFENTRY_CIPHERKEY];
+            configEntries[SWMOD_CONFENTRY_CIPHERKEY] = cipherKey;
         }
     }
     
@@ -258,11 +255,11 @@
 }
 
 - (NSString *)version {
-    NSString *version = [configEntries objectForKey:SWMOD_CONFENTRY_VERSION];
+    NSString *version = configEntries[SWMOD_CONFENTRY_VERSION];
     if(version == nil) {
         version = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_VERSION];
         if(version != nil) {
-            [configEntries setObject:version forKey:SWMOD_CONFENTRY_VERSION];
+            configEntries[SWMOD_CONFENTRY_VERSION] = version;
         }
     }
     
@@ -270,11 +267,11 @@
 }
 
 - (NSString *)minVersion {
-    NSString *minVersion = [configEntries objectForKey:SWMOD_CONFENTRY_MINVERSION];
+    NSString *minVersion = configEntries[SWMOD_CONFENTRY_MINVERSION];
     if(minVersion == nil) {
         minVersion = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_MINVERSION];
         if(minVersion != nil) {
-            [configEntries setObject:minVersion forKey:SWMOD_CONFENTRY_MINVERSION];
+            configEntries[SWMOD_CONFENTRY_MINVERSION] = minVersion;
         }
     }
     
@@ -283,7 +280,7 @@
 
 /** this might be RTF string  but the return value will be converted to UTF8 */
 - (NSString *)aboutText {
-    NSMutableString *aboutText = [configEntries objectForKey:SWMOD_CONFENTRY_ABOUT];
+    NSMutableString *aboutText = configEntries[SWMOD_CONFENTRY_ABOUT];
     if(aboutText == nil) {
         aboutText = [NSMutableString stringWithString:[self configFileEntryForConfigKey:SWMOD_CONFENTRY_ABOUT]];
         if(aboutText != nil) {
@@ -339,7 +336,7 @@
         } else {
             aboutText = [NSMutableString string];
         }
-        [configEntries setObject:aboutText forKey:SWMOD_CONFENTRY_ABOUT];
+        configEntries[SWMOD_CONFENTRY_ABOUT] = aboutText;
     }
     
     return aboutText;    
@@ -352,11 +349,11 @@
 
 - (BOOL)isEditable {
     BOOL ret = NO;
-    NSString *editable = [configEntries objectForKey:SWMOD_CONFENTRY_EDITABLE];
+    NSString *editable = configEntries[SWMOD_CONFENTRY_EDITABLE];
     if(editable == nil) {
         editable = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_EDITABLE];
         if(editable != nil) {
-            [configEntries setObject:editable forKey:SWMOD_CONFENTRY_EDITABLE];
+            configEntries[SWMOD_CONFENTRY_EDITABLE] = editable;
         }
     }
     
@@ -371,11 +368,11 @@
 
 - (BOOL)isRTL {
     BOOL ret = NO;
-    NSString *direction = [configEntries objectForKey:SWMOD_CONFENTRY_DIRECTION];
+    NSString *direction = configEntries[SWMOD_CONFENTRY_DIRECTION];
     if(direction == nil) {
         direction = [self configFileEntryForConfigKey:SWMOD_CONFENTRY_DIRECTION];
         if(direction != nil) {
-            [configEntries setObject:direction forKey:SWMOD_CONFENTRY_DIRECTION];
+            configEntries[SWMOD_CONFENTRY_DIRECTION] = direction;
         }
     }
     
@@ -463,7 +460,7 @@
     
     NSMutableDictionary	*cipherKeys = [NSMutableDictionary dictionaryWithDictionary:
                                        [[NSUserDefaults standardUserDefaults] objectForKey:DefaultsModuleCipherKeysKey]];
-    [cipherKeys setObject:unlockKey forKey:[self name]];
+    cipherKeys[[self name]] = unlockKey;
     [[NSUserDefaults standardUserDefaults] setObject:cipherKeys forKey:DefaultsModuleCipherKeysKey];
     
 	[swManager setCipherKey:unlockKey forModuleNamed:[self name]];
@@ -514,25 +511,25 @@
 - (id)attributeValueForParsedLinkData:(NSDictionary *)data withTextRenderType:(TextPullType)textType {
     id ret = nil;
     
-    NSString *passage = [data objectForKey:ATTRTYPE_PASSAGE];
+    NSString *passage = data[ATTRTYPE_PASSAGE];
     if(passage) {
         passage = [[passage stringByReplacingOccurrencesOfString:@"+" withString:@" "] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
     } 
-    NSString *attrType = [data objectForKey:ATTRTYPE_TYPE];
+    NSString *attrType = data[ATTRTYPE_TYPE];
     if([attrType isEqualToString:@"n"]) {
         NSString *footnoteText = [self entryAttributeValueFootnoteOfType:attrType 
-                                                              indexValue:[data objectForKey:ATTRTYPE_VALUE] 
+                                                              indexValue:data[ATTRTYPE_VALUE]
                                                                   forKey:[SwordKey swordKeyWithRef:passage]];
         ret = footnoteText;
     } else if([attrType isEqualToString:@"x"] || [attrType isEqualToString:@"scriptRef"] || [attrType isEqualToString:@"scripRef"]) {
         NSString *key = @"";
         if([attrType isEqualToString:@"x"]) {
             key = [self entryAttributeValueFootnoteOfType:attrType
-                                               indexValue:[data objectForKey:ATTRTYPE_VALUE] 
+                                               indexValue:data[ATTRTYPE_VALUE]
                                                    forKey:[SwordKey swordKeyWithRef:passage]];            
         } else {
-            key = [[[data objectForKey:ATTRTYPE_VALUE] stringByReplacingOccurrencesOfString:@"+" 
-                                                                                 withString:@" "] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];            
+            key = [[data[ATTRTYPE_VALUE] stringByReplacingOccurrencesOfString:@"+"
+                                                                   withString:@" "] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
         }
         if(textType == TextTypeRendered) {
             ret = [self renderedTextEntriesForRef:key];

Modified: trunk/bindings/objc/test/SwordModuleTest.m
===================================================================
--- trunk/bindings/objc/test/SwordModuleTest.m	2014-10-06 14:18:19 UTC (rev 3264)
+++ trunk/bindings/objc/test/SwordModuleTest.m	2014-10-08 13:44:48 UTC (rev 3265)
@@ -29,9 +29,8 @@
     mod = [mgr moduleWithName:@"GerNeUe"];
 }
 
-
 - (void)testModuleIntroduction {
-    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerNeUe"];
+    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"KJV"];
 
     NSString *modIntro = [bible moduleIntroduction];
     NSLog(@"mod intro: %@", modIntro);
@@ -40,7 +39,7 @@
 }
 
 - (void)testFirstBookATIntro {
-    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerNeUe"];
+    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"KJV"];
     
     SwordBibleBook *book = [bible bookList][0];
     NSString *intro = [bible bookIntroductionFor:book];
@@ -49,9 +48,19 @@
     XCTAssertTrue([intro hasPrefix:@" <!P><br />Das erste Buch der Bibel wird auch Genesis"]);
 }
 
-- (void)testFirstBookNTIntro {
+- (void)testFirstBookATIntroGer {
     SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerNeUe"];
 
+    SwordBibleBook *book = [bible bookList][0];
+    NSString *intro = [bible bookIntroductionFor:book];
+    NSLog(@"testament: '%i', book '%@' intro: %@", [book testament], [book name], intro);
+    XCTAssertNotNil(intro);
+    XCTAssertTrue([intro hasPrefix:@" <!P><br />Das erste Buch der Bibel wird auch Genesis"]);
+}
+
+- (void)testFirstBookNTIntro {
+    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"KJV"];
+
     SwordBibleBook *book = [bible bookWithNamePrefix:@"Mat"];
     NSString *intro = [bible bookIntroductionFor:book];
     NSLog(@"testament: '%i', book '%@' intro: %@", [book testament], [book name], intro);
@@ -59,12 +68,12 @@
     XCTAssertTrue([intro hasPrefix:@" <!P><br />Um die Zeit der Apostelversammlung herum"]);
 }
 
-- (void)testFirstChapterIntroInGen {
+- (void)testFirstBookNTIntroGer {
     SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerNeUe"];
 
-    SwordBibleBook *book = [bible bookWithNamePrefix:@"Gen"];
-    NSString *intro = [bible chapterIntroductionIn:book forChapter:1];
-    NSLog(@"testament: '%i', book '%@', intro: %@", [book testament], [book name], intro);
+    SwordBibleBook *book = [bible bookWithNamePrefix:@"Mat"];
+    NSString *intro = [bible bookIntroductionFor:book];
+    NSLog(@"testament: '%i', book '%@' intro: %@", [book testament], [book name], intro);
     XCTAssertNotNil(intro);
     XCTAssertTrue([intro hasPrefix:@" <!P><br />Um die Zeit der Apostelversammlung herum"]);
 }
@@ -80,6 +89,17 @@
     [mgr setGlobalOption:SW_OPTION_HEADINGS value:SW_OFF];
 }
 
+- (void)testPreverseHeading2 {
+    SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerNeUe"];
+
+    [mgr setGlobalOption:SW_OPTION_HEADINGS value:SW_ON];
+    SwordBibleTextEntry *text = (SwordBibleTextEntry *) [bible textEntryForKeyString:@"Numbers 4:21" textType:TextTypeRendered];
+    NSLog(@"Preverse text: %@", [text preVerseHeading]);
+    XCTAssertTrue([[text preVerseHeading] length] > 0);
+    XCTAssertTrue([[text preVerseHeading] isEqualToString:@"<title>Die Sonderstellung der Leviten</title>"]);
+    [mgr setGlobalOption:SW_OPTION_HEADINGS value:SW_OFF];
+}
+
 - (void)testLoopRenderedVerses {
     SwordBible *bible = (SwordBible *)[mgr moduleWithName:@"GerSch"];
     XCTAssertNotNil(bible, @"Module is nil");




More information about the sword-cvs mailing list