Codota Logo
ShadowCanvas.getTextHistoryCount
Code IndexAdd Codota to your IDE (free)

How to use
getTextHistoryCount
method
in
org.robolectric.shadows.ShadowCanvas

Best Java code snippets using org.robolectric.shadows.ShadowCanvas.getTextHistoryCount (Showing top 5 results out of 315)

  • Common ways to obtain ShadowCanvas
private void myMethod () {
ShadowCanvas s =
  • Codota IconObject instance;(ShadowCanvas) Shadow.extract(instance)
  • Smart code suggestions by Codota
}
origin: robolectric/robolectric

@Test
public void resetCanvasHistory_shouldClearTheHistoryAndDescription() throws Exception {
 Canvas canvas = new Canvas();
 canvas.drawPath(new Path(), new Paint());
 canvas.drawText("hi", 1, 2, new Paint());
 ShadowCanvas shadow = shadowOf(canvas);
 shadow.resetCanvasHistory();
 assertThat(shadow.getPathPaintHistoryCount()).isEqualTo(0);
 assertThat(shadow.getTextHistoryCount()).isEqualTo(0);
 assertEquals("", shadow.getDescription());
}
origin: robolectric/robolectric

@Test
public void shouldRecordText_charSequenceOverload() throws Exception {
 Canvas canvas = new Canvas();
 Paint paint = new Paint();
 paint.setColor(1);
 // StringBuilder implements CharSequence:
 canvas.drawText(new StringBuilder("hello"), 1, 4, 1f, 2f, paint);
 ShadowCanvas shadowCanvas = shadowOf(canvas);
 assertThat(shadowCanvas.getTextHistoryCount()).isEqualTo(1);
 assertEquals(1f, shadowCanvas.getDrawnTextEvent(0).x, 0);
 assertEquals(2f, shadowCanvas.getDrawnTextEvent(0).y, 0);
 assertEquals(paint, shadowCanvas.getDrawnTextEvent(0).paint);
 assertEquals("ell", shadowCanvas.getDrawnTextEvent(0).text);
}
origin: robolectric/robolectric

@Test
public void shouldRecordText_charArrayOverload() throws Exception {
 Canvas canvas = new Canvas();
 Paint paint = new Paint();
 paint.setColor(1);
 canvas.drawText(new char[]{'h', 'e', 'l', 'l', 'o'}, 2, 3, 1f, 2f, paint);
 ShadowCanvas shadowCanvas = shadowOf(canvas);
 assertThat(shadowCanvas.getTextHistoryCount()).isEqualTo(1);
 assertEquals(1f, shadowCanvas.getDrawnTextEvent(0).x, 0);
 assertEquals(2f, shadowCanvas.getDrawnTextEvent(0).y, 0);
 assertEquals(paint, shadowCanvas.getDrawnTextEvent(0).paint);
 assertEquals("llo", shadowCanvas.getDrawnTextEvent(0).text);
}
origin: robolectric/robolectric

@Test
public void shouldRecordText_stringWithRangeOverload() throws Exception {
 Canvas canvas = new Canvas();
 Paint paint = new Paint();
 paint.setColor(1);
 canvas.drawText("hello", 1, 4, 1f, 2f, paint);
 ShadowCanvas shadowCanvas = shadowOf(canvas);
 assertThat(shadowCanvas.getTextHistoryCount()).isEqualTo(1);
 assertEquals(1f, shadowCanvas.getDrawnTextEvent(0).x, 0);
 assertEquals(2f, shadowCanvas.getDrawnTextEvent(0).y, 0);
 assertEquals(paint, shadowCanvas.getDrawnTextEvent(0).paint);
 assertEquals("ell", shadowCanvas.getDrawnTextEvent(0).text);
}
origin: robolectric/robolectric

@Test
public void shouldRecordText() throws Exception {
 Canvas canvas = new Canvas();
 Paint paint = new Paint();
 Paint paint2 = new Paint();
 paint.setColor(1);
 paint2.setColor(5);
 canvas.drawText("hello", 1, 2, paint);
 canvas.drawText("hello 2", 4, 6, paint2);
 ShadowCanvas shadowCanvas = shadowOf(canvas);
 assertThat(shadowCanvas.getTextHistoryCount()).isEqualTo(2);
 assertEquals(1f, shadowCanvas.getDrawnTextEvent(0).x, 0);
 assertEquals(2f, shadowCanvas.getDrawnTextEvent(0).y, 0);
 assertEquals(4f, shadowCanvas.getDrawnTextEvent(1).x, 0);
 assertEquals(6f, shadowCanvas.getDrawnTextEvent(1).y, 0);
 assertEquals(paint, shadowCanvas.getDrawnTextEvent(0).paint);
 assertEquals(paint2, shadowCanvas.getDrawnTextEvent(1).paint);
 assertEquals("hello", shadowCanvas.getDrawnTextEvent(0).text);
 assertEquals("hello 2", shadowCanvas.getDrawnTextEvent(1).text);
}
org.robolectric.shadowsShadowCanvasgetTextHistoryCount

Popular methods of ShadowCanvas

  • getDescription
  • getPathPaintHistoryCount
  • appendDescription
  • describeBitmap
  • separateLines
  • formatColorMatric
  • getArcPaintHistoryCount
  • getDrawnArc
  • getDrawnCircle
  • getDrawnLine
  • getDrawnOval
  • getDrawnPath
  • getDrawnOval,
  • getDrawnPath,
  • getDrawnPathPaint,
  • getDrawnRect,
  • getDrawnTextEvent,
  • getLinePaintHistoryCount,
  • getOvalPaintHistoryCount,
  • getRectPaintHistoryCount,
  • resetCanvasHistory

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • String (java.lang)
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JFileChooser (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now