1 19 20 package org.netbeans.spi.editor.highlighting.performance; 21 22 import javax.swing.text.PlainDocument ; 23 import javax.swing.text.SimpleAttributeSet ; 24 import junit.framework.TestSuite; 25 import org.netbeans.junit.NbTestCase; 26 import org.netbeans.junit.NbTestSuite; 27 import org.netbeans.spi.editor.highlighting.support.PositionsBag; 28 import org.netbeans.spi.editor.highlighting.HighlightsSequence; 29 30 34 public class PositionsBagFindHighlightTest extends NbTestCase { 35 36 public static TestSuite suite() { 37 return NbTestSuite.speedSuite(PositionsBagFindHighlightTest.class, 2, 3); 38 } 39 40 private int cnt = 0; 41 private PositionsBag bag = null; 42 private int startOffset; 43 private int endOffset; 44 45 46 public PositionsBagFindHighlightTest(String name) { 47 super(name); 48 } 49 50 protected void setUp() { 51 cnt = this.getTestNumber(); 52 bag = new PositionsBag(new PlainDocument (), false); 53 54 for(int i = 0; i < cnt; i++) { 55 bag.addHighlight(new SimplePosition(i * 10), new SimplePosition(i * 10 + 5), SimpleAttributeSet.EMPTY); 56 } 57 58 startOffset = 10 * cnt / 5 - 1; 59 endOffset = 10 * (cnt/ 5 + 1) - 1; 60 61 System.out.println("cnt = " + cnt + " : startOffset = " + startOffset + " : endOffset = " + endOffset); 62 } 63 64 public void testFindHighlight10() { 65 HighlightsSequence seq = bag.getHighlights(startOffset, endOffset); 66 } 67 68 public void testFindHighlight10000() { 69 HighlightsSequence seq = bag.getHighlights(startOffset, endOffset); 70 } 71 } 72 | Popular Tags |