mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-13 15:57:12 +00:00
Test for [RTFHandler parseFontTable]
This changeset includes changes in relevant classes to make them easier to test.
This commit is contained in:
1 parent
7e4571874e
commit
a0b15d0c8c
3 files changed
+188
-15
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