Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spoonを使わずにテストケースでスクショを撮りたい

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 Spoonを使わずにテストケースでスクショを撮りたい

Avatar for Victor Lee

Victor Lee

June 28, 2018

More Decks by Victor Lee

Other Decks in Programming

Transcript

  1. ςετέʔεͰΞϓϦ಺ϝοηʔδͷදࣔΛ֬ೝ͍ͨ͠ ‣ όϦΤʔγϣϯ͕ଟ͗͢Δ ‣ ΞϓϦ಺ϝοηʔδͷछྨ ‣ ղ૾౓ ‣ ը૾ͷΞεϖΫτൺ ‣

    จࣈ਺ ‣ ɾɾɾ ‣ 6*ςετͰΞαʔγϣϯॻ͘ͷ͸ඇݱ࣮త ‣ ςετέʔεͰࣗಈͰεΫγϣࡱΓ͍ͨ
  2. 7JFX͑͋͞Ε͹Ͱ͖Δ ‣ 'SBHNFOU5BHΛ஌͍ͬͯΔ Fragment fragment = activityRule.getActivity() .getFragmentManager() .findFragmentByTag(fragmentTag); if

    (fragment != null) { View view = ((DialogFragment) fragment).getDialog() .getWindow() .getDecorView() .getRootView(); view.draw(canvas); }
  3. ͣΕΔͷͰௐ੔ Fragment fragment = activityRule.getActivity() .getFragmentManager() .findFragmentByTag(fragmentTag); if (fragment !=

    null) { View view = ((DialogFragment) fragment).getDialog() .getWindow() .getDecorView() .getRootView(); int[] loc = new int[2]; view.getLocationOnScreen(loc); canvas.translate(loc[0], loc[1]); view.draw(canvas);