mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-12 23:37:15 +00:00
Merge pull request #213 from zentyal/jamor/unittest-merge
Add RTFHandler unittest
This commit is contained in:
commit
2d5995a8f4
20 files changed
+1005
-107
No files matched your search
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
@class RTFFontTable;
|
||||
|
||||
@interface RTFHandler : NSObject
|
||||
{
|
||||
NSMapTable *_charsets;
|
||||
@@ -41,6 +43,11 @@
|
||||
|
||||
- (id) initWithData: (NSData *) theData;
|
||||
- (NSMutableData *) parse;
|
||||
|
||||
- (RTFFontTable *) parseFontTable;
|
||||
- (void) mangleInternalStateWithBytesPtr: (const char*) newBytes
|
||||
andCurrentPos: (int) newCurrentPos;
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
@@ -84,6 +91,7 @@
|
||||
unsigned int index;
|
||||
}
|
||||
|
||||
- (NSString *) description;
|
||||
@end
|
||||
|
||||
//
|
||||
@@ -97,8 +105,8 @@
|
||||
|
||||
- (void) addFontInfo: (RTFFontInfo *) theFontInfo
|
||||
atIndex: (unsigned int ) theIndex;
|
||||
|
||||
- (RTFFontInfo *) fontInfoAtIndex: (unsigned int ) theIndex;
|
||||
- (NSString *) description;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RTFHandler.h"
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSException.h>
|
||||
|
||||
//
|
||||
// Useful macros
|
||||
@@ -352,6 +353,7 @@ const unsigned short ansicpg874[256] = {
|
||||
RTFFontInfo *fontInfo;
|
||||
|
||||
description = [NSMutableString stringWithFormat: @"Number of fonts: %u\n", [fontInfos count]];
|
||||
|
||||
enumerator = [fontInfos objectEnumerator];
|
||||
while ((fontInfo = [enumerator nextObject]))
|
||||
{
|
||||
@@ -563,6 +565,9 @@ static void _init_fontCws_table()
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/*
|
||||
Returns pointer to the control word and in len pointer its length including numeric argument
|
||||
*/
|
||||
- (const char *) parseControlWord: (unsigned int *) len
|
||||
{
|
||||
const char *start, *end;
|
||||
@@ -1457,4 +1462,12 @@ inline static void parseUl(RTFHandler *self, BOOL hasArg, int arg, RTFFormatting
|
||||
return [_html autorelease];
|
||||
}
|
||||
|
||||
/* This method is for ease of testing and should not be used in normal operations */
|
||||
- (void) mangleInternalStateWithBytesPtr: (const char*) newBytes
|
||||
andCurrentPos: (int) newCurrentPos
|
||||
{
|
||||
_bytes = newBytes;
|
||||
_current_pos = newCurrentPos;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user