OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 146 → Rev 147

/trunk/jOpenCalendar/src/org/jopencalendar/LayoutUtilsTest.java
New file
0,0 → 1,39
package org.jopencalendar;
 
import static org.junit.Assert.assertEquals;
 
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
 
public class LayoutUtilsTest {
 
@Before
public void setUp() throws Exception {
}
 
@After
public void tearDown() throws Exception {
}
 
@Test
public void testFindBreak() {
final String str = "0123-56 89";
assertEquals(-1, LayoutUtils.findBreakBefore(str, 0));
assertEquals(-1, LayoutUtils.findBreakBefore(str, 3));
assertEquals(4, LayoutUtils.findBreakBefore(str, 4));
assertEquals(4, LayoutUtils.findBreakBefore(str, 5));
assertEquals(4, LayoutUtils.findBreakBefore(str, 6));
assertEquals(7, LayoutUtils.findBreakBefore(str, 7));
assertEquals(7, LayoutUtils.findBreakBefore(str, 9));
 
assertEquals(-1, LayoutUtils.findBreakAfter(str, 9));
assertEquals(-1, LayoutUtils.findBreakAfter(str, 8));
assertEquals(7, LayoutUtils.findBreakAfter(str, 7));
assertEquals(7, LayoutUtils.findBreakAfter(str, 5));
assertEquals(4, LayoutUtils.findBreakAfter(str, 4));
assertEquals(4, LayoutUtils.findBreakAfter(str, 3));
assertEquals(4, LayoutUtils.findBreakAfter(str, 0));
}
 
}