Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Potapov committed Oct 30, 2017
2 parents 0650804 + 65fd8db commit 397e90d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/example/poliwhirl/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MainActivity : AppCompatActivity() {
}
}

borderSizeDivMul.setText(poliwhirl.borderSizeMul.toString())
borderSizeDivMul.setText(poliwhirl.verticalBorderSizeMul.toString())
borderSizeDivMul.addTextChangedListener(object : TextWatcherAdapter() {
override fun afterTextChanged(s: Editable?) {
poliwhirl.setBorderSizeDivideMultiplier(Math.max(1, parse(s.toString())))
Expand Down
2 changes: 2 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ dokka {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.5.1'

compile 'com.android.support:support-annotations:27.0.0'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
Expand Down
15 changes: 0 additions & 15 deletions library/src/test/java/com/antonpotapov/ExampleUnitTest.java

This file was deleted.

60 changes: 60 additions & 0 deletions library/src/test/java/com/antonpotapov/PoliwhirlApiTests.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.antonpotapov

import android.graphics.Bitmap
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

/**
* ======================================
* Created by awesome potapov on 30.10.17.
* ======================================
*/
@RunWith(RobolectricTestRunner::class)
class PoliwhirlApiTests {

@Test(expected = IllegalArgumentException::class)
fun testApiAccuracy1() {
Poliwhirl().setAccuracy(0).generate(Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888))
}

@Test(expected = IllegalArgumentException::class)
fun testApiAccuracy2() {
Poliwhirl().setAccuracy(11).generate(Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888))
}

@Test(expected = IllegalArgumentException::class)
fun testApiDistance() {
Poliwhirl().setMinAvailableColorDistance(-1)
}

@Test(expected = IllegalArgumentException::class)
fun testApiHorizontalBorder1() {
Poliwhirl().setHorizontalBorderSizeDivideMultiplier(0)
}

@Test(expected = IllegalArgumentException::class)
fun testApiHorizontalBorder2() {
Poliwhirl().setHorizontalBorderSizeDivideMultiplier(1)
}

@Test(expected = IllegalArgumentException::class)
fun testApiVerticalBorder1() {
Poliwhirl().setVerticalBorderSizeDivideMultiplier(0)
}

@Test(expected = IllegalArgumentException::class)
fun testApiVerticalBorder2() {
Poliwhirl().setVerticalBorderSizeDivideMultiplier(1)
}

@Test(expected = IllegalArgumentException::class)
fun testApiBorder1() {
Poliwhirl().setBorderSizeDivideMultiplier(0)
}

@Test(expected = IllegalArgumentException::class)
fun testApiBorder2() {
Poliwhirl().setBorderSizeDivideMultiplier(1)
}
}

0 comments on commit 397e90d

Please sign in to comment.