選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LineBreakUtilsTestCase.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.text.linebreak;
  19. import static org.junit.Assert.assertEquals;
  20. import org.junit.Test;
  21. /**
  22. * TODO add javadoc
  23. *
  24. *
  25. */
  26. public class LineBreakUtilsTestCase {
  27. @Test
  28. public void testLineBreakProperty() {
  29. assertEquals(LineBreakUtils.getLineBreakProperty('A'), LineBreakUtils.LINE_BREAK_PROPERTY_AL);
  30. assertEquals(LineBreakUtils.getLineBreakProperty('1'), LineBreakUtils.LINE_BREAK_PROPERTY_NU);
  31. assertEquals(LineBreakUtils.getLineBreakProperty('\n'), LineBreakUtils.LINE_BREAK_PROPERTY_LF);
  32. assertEquals(LineBreakUtils.getLineBreakProperty('\r'), LineBreakUtils.LINE_BREAK_PROPERTY_CR);
  33. assertEquals(LineBreakUtils.getLineBreakProperty('('), LineBreakUtils.LINE_BREAK_PROPERTY_OP);
  34. assertEquals(LineBreakUtils.getLineBreakProperty('\u1F7E'), 0);
  35. }
  36. @Test
  37. public void testLineBreakPair() {
  38. assertEquals(
  39. LineBreakUtils.getLineBreakPairProperty(
  40. LineBreakUtils.LINE_BREAK_PROPERTY_CM,
  41. LineBreakUtils.LINE_BREAK_PROPERTY_CL),
  42. LineBreakUtils.PROHIBITED_BREAK);
  43. assertEquals(
  44. LineBreakUtils.getLineBreakPairProperty(
  45. LineBreakUtils.LINE_BREAK_PROPERTY_CL,
  46. LineBreakUtils.LINE_BREAK_PROPERTY_CM),
  47. LineBreakUtils.COMBINING_INDIRECT_BREAK);
  48. assertEquals(
  49. LineBreakUtils.getLineBreakPairProperty(
  50. LineBreakUtils.LINE_BREAK_PROPERTY_IS,
  51. LineBreakUtils.LINE_BREAK_PROPERTY_PR),
  52. LineBreakUtils.DIRECT_BREAK);
  53. assertEquals(
  54. LineBreakUtils.getLineBreakPairProperty(
  55. LineBreakUtils.LINE_BREAK_PROPERTY_AL,
  56. LineBreakUtils.LINE_BREAK_PROPERTY_OP),
  57. LineBreakUtils.INDIRECT_BREAK);
  58. assertEquals(
  59. LineBreakUtils.getLineBreakPairProperty(
  60. LineBreakUtils.LINE_BREAK_PROPERTY_LF,
  61. LineBreakUtils.LINE_BREAK_PROPERTY_CM),
  62. 0);
  63. }
  64. }