commit be0dad5ef3c48b1e98def6e3111da3cbfe1ac556
parent 4b0f2b7d51c01c2e8a418ed8d30b1e68ea3a802f
Author: gstraube <gstraube@mailbox.org>
Date: Sat, 12 Aug 2017 16:08:42 +0200
Verify that a positive deviation of 10 cents is displayed correctly
Diffstat:
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/app/src/androidTest/java/com/github/cythara/TunerViewTest.java b/app/src/androidTest/java/com/github/cythara/TunerViewTest.java
@@ -58,6 +58,28 @@ public class TunerViewTest {
writeToFile(reference, "reference.png");
}
+ @Test
+ public void positive_10_cents_deviation_is_displayed() throws IOException {
+ MainActivity mainActivity = mActivityRule.getActivity();
+
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inScaled = false;
+ Bitmap reference = BitmapFactory.decodeResource(mainActivity.getResources(),
+ R.drawable.positive_10_cents, options);
+
+ Bitmap generated = Bitmap.createBitmap(2048, 1024, Bitmap.Config.ARGB_4444);
+ Canvas canvas = new Canvas(generated);
+ TunerView tunerView = (TunerView) mainActivity.findViewById(R.id.pitch);
+ tunerView.setPitchDifference(new PitchDifference(Note.B3, 10));
+
+ tunerView.draw(canvas);
+
+ Assert.assertTrue(reference.sameAs(generated));
+
+ writeToFile(generated, "generated.png");
+ writeToFile(reference, "reference.png");
+ }
+
private void writeToFile(Bitmap bitmap, String name) throws IOException {
File sdCard = Environment.getExternalStorageDirectory();
FileOutputStream out = null;
diff --git a/app/src/main/res/drawable/positive_10_cents.png b/app/src/main/res/drawable/positive_10_cents.png
Binary files differ.