Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/util/XMLUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/XMLUtil.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/util/XMLUtil.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/util/XMLUtil.java Tue Apr 9 17:31:41 2013 @@ -186,19 +186,19 @@ public final class XMLUtil implements XM * @param paCount the number of entries to encode from adjustments array * @return the encoded value */ - public static String encodePositionAdjustments ( int[][] dp, int paCount ) { + public static String encodePositionAdjustments (int[][] dp, int paCount) { assert dp != null; StringBuffer sb = new StringBuffer(); int na = paCount; int nz = 0; - sb.append ( na ); - for ( int i = 0; i < na; i++ ) { + sb.append (na); + for (int i = 0; i < na; i++) { int[] pa = dp [ i ]; - if ( pa != null ) { - for ( int k = 0; k < 4; k++ ) { + if (pa != null) { + for (int k = 0; k < 4; k++) { int a = pa [ k ]; - if ( a != 0 ) { - encodeNextAdjustment ( sb, nz, a ); + if (a != 0) { + encodeNextAdjustment (sb, nz, a); nz = 0; } else { nz++; @@ -208,7 +208,7 @@ public final class XMLUtil implements XM nz += 4; } } - encodeNextAdjustment ( sb, nz, 0 ); + encodeNextAdjustment (sb, nz, 0); return sb.toString(); } @@ -223,32 +223,32 @@ public final class XMLUtil implements XM * @param dp the adjustments array * @return the encoded value */ - public static String encodePositionAdjustments ( int[][] dp ) { + public static String encodePositionAdjustments (int[][] dp) { assert dp != null; - return encodePositionAdjustments ( dp, dp.length ); + return encodePositionAdjustments (dp, dp.length); } - private static void encodeNextAdjustment ( StringBuffer sb, int nz, int a ) { - encodeZeroes ( sb, nz ); - encodeAdjustment ( sb, a ); + private static void encodeNextAdjustment (StringBuffer sb, int nz, int a) { + encodeZeroes (sb, nz); + encodeAdjustment (sb, a); } - private static void encodeZeroes ( StringBuffer sb, int nz ) { - if ( nz > 0 ) { - sb.append ( ' ' ); - if ( nz == 1 ) { - sb.append ( '0' ); + private static void encodeZeroes (StringBuffer sb, int nz) { + if (nz > 0) { + sb.append (' '); + if (nz == 1) { + sb.append ('0'); } else { - sb.append ( 'Z' ); - sb.append ( nz ); + sb.append ('Z'); + sb.append (nz); } } } - private static void encodeAdjustment ( StringBuffer sb, int a ) { - if ( a != 0 ) { - sb.append ( ' ' ); - sb.append ( a ); + private static void encodeAdjustment (StringBuffer sb, int a) { + if (a != 0) { + sb.append (' '); + sb.append (a); } } @@ -258,21 +258,21 @@ public final class XMLUtil implements XM * @param value the encoded value * @return the position adjustments array */ - public static int[][] decodePositionAdjustments ( String value ) { + public static int[][] decodePositionAdjustments (String value) { int[][] dp = null; - if ( value != null ) { - String[] sa = value.split ( "\\s" ); - if ( sa != null ) { - if ( sa.length > 0 ) { - int na = Integer.parseInt ( sa[0] ); + if (value != null) { + String[] sa = value.split ("\\s"); + if (sa != null) { + if (sa.length > 0) { + int na = Integer.parseInt (sa[0]); dp = new int [ na ] [ 4 ]; - for ( int i = 1, n = sa.length, k = 0; i < n; i++ ) { + for (int i = 1, n = sa.length, k = 0; i < n; i++) { String s = sa [ i ]; - if ( s.charAt(0) == 'Z' ) { - int nz = Integer.parseInt ( s.substring ( 1 ) ); + if (s.charAt(0) == 'Z') { + int nz = Integer.parseInt (s.substring (1)); k += nz; } else { - dp [ k / 4 ] [ k % 4 ] = Integer.parseInt ( s ); + dp [ k / 4 ] [ k % 4 ] = Integer.parseInt (s); k += 1; } }
Modified: xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/mif/MIFHandler.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/mif/MIFHandler.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/mif/MIFHandler.java (original) +++ xmlgraphics/fop/trunk/src/sandbox/org/apache/fop/render/mif/MIFHandler.java Tue Apr 9 17:31:41 2013 @@ -351,12 +351,12 @@ public class MIFHandler extends FOEventH } public void character(Character c) { - appendCharacters ( new String ( new char[] {c.getCharacter()} ) ); + appendCharacters (new String (new char[] {c.getCharacter()})); } /** {@inheritDoc} */ public void characters(FOText foText) { - appendCharacters ( foText.getCharSequence().toString() ); + appendCharacters (foText.getCharSequence().toString()); } /** {@inheritDoc} */ @@ -367,7 +367,7 @@ public class MIFHandler extends FOEventH public void endPageNumber(PageNumber pagenum) { } - private void appendCharacters ( String str ) { + private void appendCharacters (String str) { if (para != null) { str = str.trim(); // break into nice length chunks Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/afp/modca/AbstractAFPObjectTest.java Tue Apr 9 17:31:41 2013 @@ -45,7 +45,7 @@ public abstract class AbstractAFPObjectT } protected final void setSut(S sut) { - if ( this.sut == null) { + if (this.sut == null) { this.sut = sut; } } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiAlgorithmTestCase.java Tue Apr 9 17:31:41 2013 @@ -76,54 +76,54 @@ public class BidiAlgorithmTestCase { public void testBidiAlgorithm() throws Exception { String ldPfx = BidiTestData.LD_PFX; int ldCount = BidiTestData.LD_CNT; - for ( int i = 0; i < ldCount; i++ ) { - int[] da = BidiTestData.readTestData ( ldPfx, i ); - if ( da != null ) { - testBidiAlgorithm ( i, da ); + for (int i = 0; i < ldCount; i++) { + int[] da = BidiTestData.readTestData (ldPfx, i); + if (da != null) { + testBidiAlgorithm (i, da); } else { - fail ( "unable to read bidi test data for resource at index " + i ); + fail ("unable to read bidi test data for resource at index " + i); } } // ensure we passed all test sequences - assertEquals ( "did not pass all test sequences", BidiTestData.NUM_TEST_SEQUENCES, passedSequences ); - if ( log.isDebugEnabled() ) { - log.debug ( "Included Sequences : " + includedSequences ); - log.debug ( "Excluded Sequences : " + excludedSequences ); - log.debug( "Passed Sequences : " + passedSequences ); + assertEquals ("did not pass all test sequences", BidiTestData.NUM_TEST_SEQUENCES, passedSequences); + if (log.isDebugEnabled()) { + log.debug ("Included Sequences : " + includedSequences); + log.debug ("Excluded Sequences : " + excludedSequences); + log.debug("Passed Sequences : " + passedSequences); } } - private void testBidiAlgorithm ( int testSet, int[] da ) throws Exception { - if ( da.length < 1 ) { - fail ( "test data is empty" ); - } else if ( da.length < ( ( da[0] * 2 ) + 1 ) ) { - fail ( "test data is truncated" ); + private void testBidiAlgorithm (int testSet, int[] da) throws Exception { + if (da.length < 1) { + fail ("test data is empty"); + } else if (da.length < ((da[0] * 2) + 1)) { + fail ("test data is truncated"); } else { int k = 0; // extract level count int n = da[k++]; // extract level array int[] la = new int [ n ]; - for ( int i = 0; i < n; i++ ) { + for (int i = 0; i < n; i++) { la[i] = da[k++]; } // extract reorder array int[] ra = new int [ n ]; - for ( int i = 0; i < n; i++ ) { + for (int i = 0; i < n; i++) { ra[i] = da[k++]; } // extract and test each test sequence int testSequence = 0; int[] ta = new int [ n ]; - while ( ( k + ( 1 + n ) ) <= da.length ) { + while ((k + (1 + n)) <= da.length) { int bs = da[k++]; - for ( int i = 0; i < n; i++ ) { + for (int i = 0; i < n; i++) { ta[i] = da[k++]; } - if ( includeSequence ( testSet, testSequence ) ) { + if (includeSequence (testSet, testSequence)) { includedSequences++; - if ( ! excludeSequence ( testSet, testSequence ) ) { - if ( testBidiAlgorithm ( testSet, testSequence, la, ra, ta, bs ) ) { + if (! excludeSequence (testSet, testSequence)) { + if (testBidiAlgorithm (testSet, testSequence, la, ra, ta, bs)) { passedSequences++; } } else { @@ -133,16 +133,16 @@ public class BidiAlgorithmTestCase { testSequence++; } // ensure we exhausted test data - assertEquals ( "extraneous test data", da.length, k ); + assertEquals ("extraneous test data", da.length, k); } } - private boolean includeTestSet ( int testSet ) { - for ( int i = 0, n = TEST_SET_RANGES.length / 2; i < n; i++ ) { - int s = TEST_SET_RANGES [ ( i * 2 ) + 0 ]; - int e = TEST_SET_RANGES [ ( i * 2 ) + 1 ]; - if ( testSet >= s ) { - if ( ( e < 0 ) || ( testSet <= e ) ) { + private boolean includeTestSet (int testSet) { + for (int i = 0, n = TEST_SET_RANGES.length / 2; i < n; i++) { + int s = TEST_SET_RANGES [ (i * 2) + 0 ]; + int e = TEST_SET_RANGES [ (i * 2) + 1 ]; + if (testSet >= s) { + if ((e < 0) || (testSet <= e)) { return true; } } @@ -150,23 +150,23 @@ public class BidiAlgorithmTestCase { return false; } - private boolean includeSequence ( int testSet, int testSequence ) { - if ( ! includeTestSet ( testSet ) ) { + private boolean includeSequence (int testSet, int testSequence) { + if (! includeTestSet (testSet)) { return false; } else { - for ( int i = 0, n = INCLUSIONS.length / 2; i < n; i++ ) { - int setno = INCLUSIONS [ ( i * 2 ) + 0 ]; - int seqno = INCLUSIONS [ ( i * 2 ) + 1 ]; - if ( setno < 0 ) { - if ( seqno < 0 ) { + for (int i = 0, n = INCLUSIONS.length / 2; i < n; i++) { + int setno = INCLUSIONS [ (i * 2) + 0 ]; + int seqno = INCLUSIONS [ (i * 2) + 1 ]; + if (setno < 0) { + if (seqno < 0) { return true; - } else if ( seqno == testSequence ) { + } else if (seqno == testSequence) { return true; } - } else if ( setno == testSet ) { - if ( seqno < 0 ) { + } else if (setno == testSet) { + if (seqno < 0) { return true; - } else if ( seqno == testSequence ) { + } else if (seqno == testSequence) { return true; } } @@ -175,20 +175,20 @@ public class BidiAlgorithmTestCase { } } - private boolean excludeSequence ( int testSet, int testSequence ) { - for ( int i = 0, n = EXCLUSIONS.length / 2; i < n; i++ ) { - int setno = EXCLUSIONS [ ( i * 2 ) + 0 ]; - int seqno = EXCLUSIONS [ ( i * 2 ) + 1 ]; - if ( setno < 0 ) { - if ( seqno < 0 ) { + private boolean excludeSequence (int testSet, int testSequence) { + for (int i = 0, n = EXCLUSIONS.length / 2; i < n; i++) { + int setno = EXCLUSIONS [ (i * 2) + 0 ]; + int seqno = EXCLUSIONS [ (i * 2) + 1 ]; + if (setno < 0) { + if (seqno < 0) { return true; - } else if ( seqno == testSequence ) { + } else if (seqno == testSequence) { return true; } - } else if ( setno == testSet ) { - if ( seqno < 0 ) { + } else if (setno == testSet) { + if (seqno < 0) { return true; - } else if ( seqno == testSequence ) { + } else if (seqno == testSequence) { return true; } } @@ -196,29 +196,29 @@ public class BidiAlgorithmTestCase { return false; } - private boolean testBidiAlgorithm ( int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs ) throws Exception { + private boolean testBidiAlgorithm (int testSet, int testSequence, int[] la, int[] ra, int[] ta, int bs) throws Exception { boolean passed = true; int n = la.length; - if ( ra.length != n ) { - fail ( "bad reorder array length, expected " + n + ", got " + ra.length ); - } else if ( ta.length != n ) { - fail ( "bad test array length, expected " + n + ", got " + ta.length ); + if (ra.length != n) { + fail ("bad reorder array length, expected " + n + ", got " + ra.length); + } else if (ta.length != n) { + fail ("bad test array length, expected " + n + ", got " + ta.length); } else { // auto-LTR - if ( ( bs & 1 ) != 0 ) { + if ((bs & 1) != 0) { // auto-LTR is performed at higher level } // LTR - if ( ( bs & 2 ) != 0 ) { - int[] levels = UnicodeBidiAlgorithm.resolveLevels ( null, ta, 0, new int [ n ], true ); - if ( ! verifyResults ( la, levels, ta, 0, testSet, testSequence ) ) { + if ((bs & 2) != 0) { + int[] levels = UnicodeBidiAlgorithm.resolveLevels (null, ta, 0, new int [ n ], true); + if (! verifyResults (la, levels, ta, 0, testSet, testSequence)) { passed = false; } } // RTL - if ( ( bs & 4 ) != 0 ) { - int[] levels = UnicodeBidiAlgorithm.resolveLevels ( null, ta, 1, new int [ n ], true ); - if ( ! verifyResults ( la, levels, ta, 1, testSet, testSequence ) ) { + if ((bs & 4) != 0) { + int[] levels = UnicodeBidiAlgorithm.resolveLevels (null, ta, 1, new int [ n ], true); + if (! verifyResults (la, levels, ta, 1, testSet, testSequence)) { passed = false; } } @@ -226,18 +226,18 @@ public class BidiAlgorithmTestCase { return passed; } - private boolean verifyResults ( int[] laExp, int[] laOut, int[] ta, int dl, int testSet, int testSequence ) { - if ( laOut.length != laExp.length ) { - fail ( "output levels array length mismatch, expected " + laExp.length + ", got " + laOut.length ); + private boolean verifyResults (int[] laExp, int[] laOut, int[] ta, int dl, int testSet, int testSequence) { + if (laOut.length != laExp.length) { + fail ("output levels array length mismatch, expected " + laExp.length + ", got " + laOut.length); return false; } else { int numMatch = 0; - for ( int i = 0, n = laExp.length; i < n; i++ ) { - if ( laExp[i] >= 0 ) { + for (int i = 0, n = laExp.length; i < n; i++) { + if (laExp[i] >= 0) { int lo = laOut[i]; int le = laExp[i]; - if ( lo != le ) { - assertEquals ( getMismatchMessage ( testSet, testSequence, i, dl ), le, lo ); + if (lo != le) { + assertEquals (getMismatchMessage (testSet, testSequence, i, dl), le, lo); } else { numMatch++; } @@ -249,16 +249,16 @@ public class BidiAlgorithmTestCase { } } - private String getMismatchMessage ( int testSet, int testSequence, int seqIndex, int defaultLevel ) { + private String getMismatchMessage (int testSet, int testSequence, int seqIndex, int defaultLevel) { StringBuffer sb = new StringBuffer(); - sb.append ( "level mismatch for default level " ); - sb.append ( defaultLevel ); - sb.append ( " at sequence index " ); - sb.append ( seqIndex ); - sb.append ( " in test sequence " ); - sb.append ( testSequence ); - sb.append ( " of test set " ); - sb.append ( testSet ); + sb.append ("level mismatch for default level "); + sb.append (defaultLevel); + sb.append (" at sequence index "); + sb.append (seqIndex); + sb.append (" in test sequence "); + sb.append (testSequence); + sb.append (" of test set "); + sb.append (testSet); return sb.toString(); } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiClassTestCase.java Tue Apr 9 17:31:41 2013 @@ -33,24 +33,24 @@ public class BidiClassTestCase { public void testBidiClasses() throws Exception { String tdPfx = BidiTestData.TD_PFX; int tdCount = BidiTestData.TD_CNT; - for ( int i = 0; i < tdCount; i++ ) { - int[] da = BidiTestData.readTestData ( tdPfx, i ); - if ( da != null ) { - testBidiClass ( da ); + for (int i = 0; i < tdCount; i++) { + int[] da = BidiTestData.readTestData (tdPfx, i); + if (da != null) { + testBidiClass (da); } else { - fail ( "unable to read bidi test data for resource at index " + i ); + fail ("unable to read bidi test data for resource at index " + i); } } } - private void testBidiClass ( int[] da ) throws Exception { + private void testBidiClass (int[] da) throws Exception { int bc = da[0]; - for ( int i = 1, n = da.length; i < n; i += 2 ) { + for (int i = 1, n = da.length; i < n; i += 2) { int s = da[i+0]; int e = da[i+1]; - for ( int c = s; c < e; c++ ) { - int cbc = BidiClass.getBidiClass ( c ); - assertEquals ( "bad bidi class for CH(" + CharUtilities.format ( c ) + ")", bc, cbc ); + for (int c = s; c < e; c++) { + int cbc = BidiClass.getBidiClass (c); + assertEquals ("bad bidi class for CH(" + CharUtilities.format (c) + ")", bc, cbc); } } } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/bidi/BidiTestData.java Tue Apr 9 17:31:41 2013 @@ -49,24 +49,24 @@ public final class BidiTestData { public static final int NUM_TEST_SEQUENCES = 216357; - public static int[] readTestData ( String prefix, int index ) { + public static int[] readTestData (String prefix, int index) { int[] data = null; InputStream is = null; Class btc = BidiTestData.class; String name = btc.getSimpleName() + "$" + prefix + index + ".ser"; try { - if ( ( is = btc.getResourceAsStream ( name ) ) != null ) { - ObjectInputStream ois = new ObjectInputStream ( is ); + if ((is = btc.getResourceAsStream (name)) != null) { + ObjectInputStream ois = new ObjectInputStream (is); data = (int[]) ois.readObject(); ois.close(); } - } catch ( IOException e ) { + } catch (IOException e) { data = null; - } catch ( ClassNotFoundException e ) { + } catch (ClassNotFoundException e) { data = null; } finally { - if ( is != null ) { - try { is.close(); } catch ( Exception e ) {} + if (is != null) { + try { is.close(); } catch (Exception e) {} } } return data; Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GDEFTestCase.java Tue Apr 9 17:31:41 2013 @@ -3056,33 +3056,33 @@ public class GDEFTestCase { @Test public void testGDEFGlyphClass() throws Exception { - performLookups ( ltGlyphClass ); + performLookups (ltGlyphClass); } @Test public void testGDEFAttachmentPoint() throws Exception { - performLookups ( ltAttachmentPoint ); + performLookups (ltAttachmentPoint); } @Test public void testGDEFLigatureCaret() throws Exception { - performLookups ( ltLigatureCaret ); + performLookups (ltLigatureCaret); } @Test public void testGDEFMarkAttachment() throws Exception { - performLookups ( ltMarkAttachment ); + performLookups (ltMarkAttachment); } /** * Perform lookups on all test data in test specification TS. * @param ts test specification */ - private void performLookups ( Object[][] ts ) { + private void performLookups (Object[][] ts) { assert ts.length > 0; Object[] tp = ts[0]; - for ( int i = 1; i < ts.length; i++ ) { - performLookups ( tp, ts[i] ); + for (int i = 1; i < ts.length; i++) { + performLookups (tp, ts[i]); } } @@ -3091,70 +3091,70 @@ public class GDEFTestCase { * @param tp test parameters * @param td test data */ - private void performLookups ( Object[] tp, Object[] td ) { + private void performLookups (Object[] tp, Object[] td) { assert tp.length > 0; - if ( td.length > 1 ) { + if (td.length > 1) { String fid = (String) td[0]; String lid = (String) td[1]; - TTXFile tf = findTTX ( fid ); - assertTrue ( tf != null ); + TTXFile tf = findTTX (fid); + assertTrue (tf != null); GlyphDefinitionTable gdef = tf.getGDEF(); - assertTrue ( gdef != null ); + assertTrue (gdef != null); String[][] tia = (String[][]) td[2]; - switch ( (int) ( (Integer) tp[0] ) ) { + switch ((int) ((Integer) tp[0])) { case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_GLYPH_CLASS: - performGlyphClassLookups ( tf, lid, tia ); + performGlyphClassLookups (tf, lid, tia); break; case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_ATTACHMENT_POINT: - performAttachmentPointLookups ( tf, lid, tia ); + performAttachmentPointLookups (tf, lid, tia); break; case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_LIGATURE_CARET: - performLigatureCaretLookups ( tf, lid, tia ); + performLigatureCaretLookups (tf, lid, tia); break; case GlyphDefinitionTable.GDEF_LOOKUP_TYPE_MARK_ATTACHMENT: - performMarkAttachmentLookups ( tf, lid, tia ); + performMarkAttachmentLookups (tf, lid, tia); break; default: - assertTrue ( "bad lookup type", false ); + assertTrue ("bad lookup type", false); break; } } } - private void performGlyphClassLookups ( TTXFile tf, String lid, String[][] tia ) { + private void performGlyphClassLookups (TTXFile tf, String lid, String[][] tia) { GlyphDefinitionTable gdef = tf.getGDEF(); assert gdef != null; - for ( String[] ti : tia ) { + for (String[] ti : tia) { assert ti != null; assert ti.length > 1; String gn = ti[0]; assert gn != null; String cn = ti[1]; assert cn != null; - int g = tf.getGlyph ( gn ); - assertTrue ( g >= 0 ); - int oc = Integer.parseInt ( cn ); - int tc = gdef.getGlyphClass ( g ); - assertEquals ( "bad glyph class for glyph \'" + gn + "\', gid(" + g + ")", oc, tc ); + int g = tf.getGlyph (gn); + assertTrue (g >= 0); + int oc = Integer.parseInt (cn); + int tc = gdef.getGlyphClass (g); + assertEquals ("bad glyph class for glyph \'" + gn + "\', gid(" + g + ")", oc, tc); } } - private void performAttachmentPointLookups ( TTXFile tf, String lid, String[][] tia ) { + private void performAttachmentPointLookups (TTXFile tf, String lid, String[][] tia) { // not yet supported by GDEF or test TTX files } - private void performLigatureCaretLookups ( TTXFile tf, String lid, String[][] tia ) { + private void performLigatureCaretLookups (TTXFile tf, String lid, String[][] tia) { // not yet supported by GDEF or test TTX files } - private void performMarkAttachmentLookups ( TTXFile tf, String lid, String[][] tia ) { + private void performMarkAttachmentLookups (TTXFile tf, String lid, String[][] tia) { // not yet supported by GDEF or test TTX files } - private String findTTXPath ( String fid ) { - for ( String[] fs : ttxFonts ) { - if ( ( fs != null ) && ( fs.length > 1 ) ) { - if ( fs[0].equals ( fid ) ) { + private String findTTXPath (String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals (fid)) { return ttxFilesRoot + File.separator + fs[1]; } } @@ -3162,14 +3162,14 @@ public class GDEFTestCase { return null; } - private TTXFile findTTX ( String fid ) { - String pn = findTTXPath ( fid ); - assertTrue ( pn != null ); + private TTXFile findTTX (String fid) { + String pn = findTTXPath (fid); + assertTrue (pn != null); try { - TTXFile tf = TTXFile.getFromCache ( pn ); + TTXFile tf = TTXFile.getFromCache (pn); return tf; - } catch ( Exception e ) { - fail ( e.getMessage() ); + } catch (Exception e) { + fail (e.getMessage()); return null; } } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GPOSTestCase.java Tue Apr 9 17:31:41 2013 @@ -319,53 +319,53 @@ public class GPOSTestCase implements Scr @Test public void testGPOSSingle() throws Exception { - performPositioning ( ltSingle ); + performPositioning (ltSingle); } @Test public void testGPOSPair() throws Exception { - performPositioning ( ltPair ); + performPositioning (ltPair); } @Test public void testGPOSCursive() throws Exception { - performPositioning ( ltCursive ); + performPositioning (ltCursive); } @Test public void testGPOSMarkToBase() throws Exception { - performPositioning ( ltMarkToBase ); + performPositioning (ltMarkToBase); } @Test public void testGPOSMarkToLigature() throws Exception { - performPositioning ( ltMarkToLigature ); + performPositioning (ltMarkToLigature); } @Test public void testGPOSMarkToMark() throws Exception { - performPositioning ( ltMarkToMark ); + performPositioning (ltMarkToMark); } @Test public void testGPOSContextual() throws Exception { - performPositioning ( ltContextual ); + performPositioning (ltContextual); } @Test public void testGPOSChainedContextual() throws Exception { - performPositioning ( ltChainedContextual ); + performPositioning (ltChainedContextual); } /** * Perform positioning on all test data in test specification TS. * @param ts test specification */ - private void performPositioning ( Object[][] ts ) { + private void performPositioning (Object[][] ts) { assert ts.length > 0; Object[] tp = ts[0]; - for ( int i = 1; i < ts.length; i++ ) { - performPositioning ( tp, ts[i] ); + for (int i = 1; i < ts.length; i++) { + performPositioning (tp, ts[i]); } } @@ -374,44 +374,44 @@ public class GPOSTestCase implements Scr * @param tp test parameters * @param td test data */ - private void performPositioning ( Object[] tp, Object[] td ) { + private void performPositioning (Object[] tp, Object[] td) { assert tp.length > 0; - if ( td.length > 5 ) { + if (td.length > 5) { String fid = (String) td[0]; String lid = (String) td[1]; String script = (String) td[2]; String language = (String) td[3]; String feature = (String) td[4]; - TTXFile tf = findTTX ( fid ); - assertTrue ( tf != null ); + TTXFile tf = findTTX (fid); + assertTrue (tf != null); GlyphPositioningTable gpos = tf.getGPOS(); - assertTrue ( gpos != null ); - GlyphPositioningSubtable[] sta = findGPOSSubtables ( gpos, script, language, feature, lid ); - assertTrue ( sta != null ); - assertTrue ( sta.length > 0 ); - ScriptContextTester sct = findScriptContextTester ( script, language, feature ); + assertTrue (gpos != null); + GlyphPositioningSubtable[] sta = findGPOSSubtables (gpos, script, language, feature, lid); + assertTrue (sta != null); + assertTrue (sta.length > 0); + ScriptContextTester sct = findScriptContextTester (script, language, feature); Object[][] tia = (Object[][]) td[5]; // test instance array - for ( Object[] ti : tia ) { // test instance - if ( ti != null ) { - if ( ti.length > 0 ) { // must have at least input glyphs + for (Object[] ti : tia) { // test instance + if (ti != null) { + if (ti.length > 0) { // must have at least input glyphs String[] igia = (String[]) ti[0]; // input glyph id array int[][] ogpa = (int[][]) ti[1]; // output glyph positioning array - GlyphSequence igs = tf.getGlyphSequence ( igia ); + GlyphSequence igs = tf.getGlyphSequence (igia); int[] widths = tf.getWidths(); int[][] tgpa = new int [ igia.length ] [ 4 ]; - boolean adjusted = GlyphPositioningSubtable.position ( igs, script, language, feature, 1000, sta, widths, tgpa, sct ); - assertTrue ( adjusted ); - assertSamePositions ( ogpa, tgpa ); + boolean adjusted = GlyphPositioningSubtable.position (igs, script, language, feature, 1000, sta, widths, tgpa, sct); + assertTrue (adjusted); + assertSamePositions (ogpa, tgpa); } } } } } - private String findTTXPath ( String fid ) { - for ( String[] fs : ttxFonts ) { - if ( ( fs != null ) && ( fs.length > 1 ) ) { - if ( fs[0].equals ( fid ) ) { + private String findTTXPath (String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals (fid)) { return ttxFilesRoot + File.separator + fs[1]; } } @@ -419,54 +419,54 @@ public class GPOSTestCase implements Scr return null; } - private TTXFile findTTX ( String fid ) { - String pn = findTTXPath ( fid ); - assertTrue ( pn != null ); + private TTXFile findTTX (String fid) { + String pn = findTTXPath (fid); + assertTrue (pn != null); try { - TTXFile tf = TTXFile.getFromCache ( pn ); + TTXFile tf = TTXFile.getFromCache (pn); return tf; - } catch ( Exception e ) { - fail ( e.getMessage() ); + } catch (Exception e) { + fail (e.getMessage()); return null; } } - private GlyphPositioningSubtable[] findGPOSSubtables ( GlyphPositioningTable gpos, String script, String language, String feature, String lid ) { - LookupTable lt = gpos.getLookupTable ( lid ); - if ( lt != null ) { + private GlyphPositioningSubtable[] findGPOSSubtables (GlyphPositioningTable gpos, String script, String language, String feature, String lid) { + LookupTable lt = gpos.getLookupTable (lid); + if (lt != null) { return (GlyphPositioningSubtable[]) lt.getSubtables(); } else { return null; } } - private ScriptContextTester findScriptContextTester ( String script, String language, String feature ) { + private ScriptContextTester findScriptContextTester (String script, String language, String feature) { return this; } - public GlyphContextTester getTester ( String feature ) { + public GlyphContextTester getTester (String feature) { return this; } - public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) { + public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) { return true; } - private void assertSamePositions ( int[][] pa1, int[][] pa2 ) { - assertNotNull ( pa1 ); - assertNotNull ( pa2 ); - assertEquals ( "unequal adjustment count", pa1.length, pa2.length ); - for ( int i = 0; i < pa1.length; i++ ) { + private void assertSamePositions (int[][] pa1, int[][] pa2) { + assertNotNull (pa1); + assertNotNull (pa2); + assertEquals ("unequal adjustment count", pa1.length, pa2.length); + for (int i = 0; i < pa1.length; i++) { int[] a1 = pa1 [ i ]; int[] a2 = pa2 [ i ]; - assertNotNull ( a1 ); - assertNotNull ( a2 ); - assertEquals ( "bad adjustment array length", 4, a1.length ); - assertEquals ( "bad adjustment array length", 4, a2.length ); - for ( int k = 0; k < a1.length; k++ ) { + assertNotNull (a1); + assertNotNull (a2); + assertEquals ("bad adjustment array length", 4, a1.length); + assertEquals ("bad adjustment array length", 4, a2.length); + for (int k = 0; k < a1.length; k++) { int p1 = a1[k]; int p2 = a2[k]; - assertEquals ( "bad adjustment", p1, p2 ); + assertEquals ("bad adjustment", p1, p2); } } } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java?rev=1466146&r1=1466145&r2=1466146&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/complexscripts/fonts/GSUBTestCase.java Tue Apr 9 17:31:41 2013 @@ -2129,43 +2129,43 @@ public class GSUBTestCase implements Scr @Test public void testGSUBSingle() throws Exception { - performSubstitutions ( ltSingle ); + performSubstitutions (ltSingle); } @Test public void testGSUBMultiple() throws Exception { - performSubstitutions ( ltMultiple ); + performSubstitutions (ltMultiple); } @Test public void testGSUBAlternate() throws Exception { - performSubstitutions ( ltAlternate ); + performSubstitutions (ltAlternate); } @Test public void testGSUBLigature() throws Exception { - performSubstitutions ( ltLigature ); + performSubstitutions (ltLigature); } @Test public void testGSUBContextual() throws Exception { - performSubstitutions ( ltContextual ); + performSubstitutions (ltContextual); } @Test public void testGSUBChainedContextual() throws Exception { - performSubstitutions ( ltChainedContextual ); + performSubstitutions (ltChainedContextual); } /** * Perform substitutions on all test data in test specification TS. * @param ts test specification */ - private void performSubstitutions ( Object[][] ts ) { + private void performSubstitutions (Object[][] ts) { assert ts.length > 0; Object[] tp = ts[0]; - for ( int i = 1; i < ts.length; i++ ) { - performSubstitutions ( tp, ts[i] ); + for (int i = 1; i < ts.length; i++) { + performSubstitutions (tp, ts[i]); } } @@ -2174,42 +2174,42 @@ public class GSUBTestCase implements Scr * @param tp test parameters * @param td test data */ - private void performSubstitutions ( Object[] tp, Object[] td ) { + private void performSubstitutions (Object[] tp, Object[] td) { assert tp.length > 0; - if ( td.length > 5 ) { + if (td.length > 5) { String fid = (String) td[0]; String lid = (String) td[1]; String script = (String) td[2]; String language = (String) td[3]; String feature = (String) td[4]; - TTXFile tf = findTTX ( fid ); - assertTrue ( tf != null ); + TTXFile tf = findTTX (fid); + assertTrue (tf != null); GlyphSubstitutionTable gsub = tf.getGSUB(); - assertTrue ( gsub != null ); - GlyphSubstitutionSubtable[] sta = findGSUBSubtables ( gsub, script, language, feature, lid ); - assertTrue ( sta != null ); - assertTrue ( sta.length > 0 ); - ScriptContextTester sct = findScriptContextTester ( script, language, feature ); + assertTrue (gsub != null); + GlyphSubstitutionSubtable[] sta = findGSUBSubtables (gsub, script, language, feature, lid); + assertTrue (sta != null); + assertTrue (sta.length > 0); + ScriptContextTester sct = findScriptContextTester (script, language, feature); String[][][] tia = (String[][][]) td[5]; // test instance array - for ( String[][] ti : tia ) { // test instance - if ( ti != null ) { - if ( ti.length > 1 ) { // must have at least input and output glyph id arrays + for (String[][] ti : tia) { // test instance + if (ti != null) { + if (ti.length > 1) { // must have at least input and output glyph id arrays String[] igia = ti[0]; // input glyph id array String[] ogia = ti[1]; // output glyph id array - GlyphSequence igs = tf.getGlyphSequence ( igia ); - GlyphSequence ogs = tf.getGlyphSequence ( ogia ); - GlyphSequence tgs = GlyphSubstitutionSubtable.substitute ( igs, script, language, feature, sta, sct ); - assertSameGlyphs ( ogs, tgs ); + GlyphSequence igs = tf.getGlyphSequence (igia); + GlyphSequence ogs = tf.getGlyphSequence (ogia); + GlyphSequence tgs = GlyphSubstitutionSubtable.substitute (igs, script, language, feature, sta, sct); + assertSameGlyphs (ogs, tgs); } } } } } - private String findTTXPath ( String fid ) { - for ( String[] fs : ttxFonts ) { - if ( ( fs != null ) && ( fs.length > 1 ) ) { - if ( fs[0].equals ( fid ) ) { + private String findTTXPath (String fid) { + for (String[] fs : ttxFonts) { + if ((fs != null) && (fs.length > 1)) { + if (fs[0].equals (fid)) { return ttxFilesRoot + File.separator + fs[1]; } } @@ -2217,49 +2217,49 @@ public class GSUBTestCase implements Scr return null; } - private TTXFile findTTX ( String fid ) { - String pn = findTTXPath ( fid ); - assertTrue ( pn != null ); + private TTXFile findTTX (String fid) { + String pn = findTTXPath (fid); + assertTrue (pn != null); try { - TTXFile tf = TTXFile.getFromCache ( pn ); + TTXFile tf = TTXFile.getFromCache (pn); return tf; - } catch ( Exception e ) { - fail ( e.getMessage() ); + } catch (Exception e) { + fail (e.getMessage()); return null; } } - private GlyphSubstitutionSubtable[] findGSUBSubtables ( GlyphSubstitutionTable gsub, String script, String language, String feature, String lid ) { - LookupTable lt = gsub.getLookupTable ( lid ); - if ( lt != null ) { + private GlyphSubstitutionSubtable[] findGSUBSubtables (GlyphSubstitutionTable gsub, String script, String language, String feature, String lid) { + LookupTable lt = gsub.getLookupTable (lid); + if (lt != null) { return (GlyphSubstitutionSubtable[]) lt.getSubtables(); } else { return null; } } - private ScriptContextTester findScriptContextTester ( String script, String language, String feature ) { + private ScriptContextTester findScriptContextTester (String script, String language, String feature) { return this; } - public GlyphContextTester getTester ( String feature ) { + public GlyphContextTester getTester (String feature) { return this; } - public boolean test ( String script, String language, String feature, GlyphSequence gs, int index, int flags ) { + public boolean test (String script, String language, String feature, GlyphSequence gs, int index, int flags) { return true; } - private void assertSameGlyphs ( GlyphSequence gs1, GlyphSequence gs2 ) { - assertNotNull ( gs1 ); - assertNotNull ( gs2 ); + private void assertSameGlyphs (GlyphSequence gs1, GlyphSequence gs2) { + assertNotNull (gs1); + assertNotNull (gs2); IntBuffer gb1 = gs1.getGlyphs(); IntBuffer gb2 = gs2.getGlyphs(); - assertEquals ( "unequal glyph count", gb1.limit(), gb2.limit() ); - for ( int i = 0; i < gb1.limit(); i++ ) { + assertEquals ("unequal glyph count", gb1.limit(), gb2.limit()); + for (int i = 0; i < gb1.limit(); i++) { int g1 = gb1.get(i); int g2 = gb2.get(i); - assertEquals ( "unequal glyph code", g1, g2 ); + assertEquals ("unequal glyph code", g1, g2); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
