Tabnine Logo
ShadowCanvas.getDrawnPath
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: robolectric/robolectric

@Test
public void drawPath_shouldRecordThePointsOfEachPathEvenWhenItIsTheSameInstance() throws Exception {
 Canvas canvas = new Canvas(targetBitmap);
 Paint paint = new Paint();
 Path path = new Path();
 path.lineTo(10, 10);
 canvas.drawPath(path, paint);
 path.reset();
 path.lineTo(20, 20);
 canvas.drawPath(path, paint);
 ShadowCanvas shadow = shadowOf(canvas);
 assertThat(shadow.getPathPaintHistoryCount()).isEqualTo(2);
 assertEquals(shadowOf(shadow.getDrawnPath(0)).getPoints().get(0), new ShadowPath.Point(10, 10, LINE_TO));
 assertEquals(shadowOf(shadow.getDrawnPath(1)).getPoints().get(0), new ShadowPath.Point(20, 20, LINE_TO));
}
origin: robolectric/robolectric

@Test
public void drawPath_shouldRecordThePathAndThePaint() throws Exception {
 Canvas canvas = new Canvas(targetBitmap);
 Path path = new Path();
 path.lineTo(10, 10);
 Paint paint = new Paint();
 paint.setColor(Color.RED);
 paint.setAlpha(7);
 canvas.drawPath(path, paint);
 // changing the values on this Paint shouldn't affect recorded painted path
 paint.setColor(Color.BLUE);
 paint.setAlpha(8);
 ShadowCanvas shadow = shadowOf(canvas);
 assertThat(shadow.getPathPaintHistoryCount()).isEqualTo(1);
 ShadowPath drawnPath = shadowOf(shadow.getDrawnPath(0));
 assertEquals(drawnPath.getPoints().get(0), new ShadowPath.Point(10, 10, LINE_TO));
 Paint drawnPathPaint = shadow.getDrawnPathPaint(0);
 assertThat(drawnPathPaint.getColor()).isEqualTo(Color.RED);
 assertThat(drawnPathPaint.getAlpha()).isEqualTo(7);
}
org.robolectric.shadowsShadowCanvasgetDrawnPath

Popular methods of ShadowCanvas

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

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now