-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from open-tool/custom_clicks_to_different_plac…
…es_of_view/#10 clicks in different places within view
- Loading branch information
Showing
15 changed files
with
593 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
sample-app/src/androidTest/java/com/atiurin/sampleapp/tests/espresso/CustomClicksTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.atiurin.sampleapp.tests.espresso | ||
|
||
import androidx.test.core.app.ActivityScenario | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import com.atiurin.sampleapp.R | ||
import com.atiurin.sampleapp.activity.CustomClicksActivity | ||
import com.atiurin.sampleapp.tests.BaseTest | ||
import com.atiurin.ultron.extensions.* | ||
import com.atiurin.ultron.testlifecycle.setupteardown.SetUpRule | ||
import org.junit.Test | ||
|
||
class CustomClicksTest : BaseTest() { | ||
|
||
private val startActivity = SetUpRule().add { | ||
ActivityScenario.launch(CustomClicksActivity::class.java) | ||
} | ||
|
||
init { | ||
ruleSequence.addLast(startActivity) | ||
} | ||
|
||
@Test | ||
fun clickTopLeft() { | ||
withId(R.id.imageView).clickTopLeft(offsetX = 30, offsetY = 30) | ||
withId(R.id.rB_top_left).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickTopCenter() { | ||
withId(R.id.imageView).clickTopCenter(offsetY = 30) | ||
withId(R.id.rB_top_center).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickTopRight() { | ||
withId(R.id.imageView).clickTopRight(offsetX = -30, offsetY = 30) | ||
withId(R.id.rB_top_right).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickCenterRight() { | ||
withId(R.id.imageView).clickCenterRight(offsetX = -30) | ||
withId(R.id.rB_center_right).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickBottomRight() { | ||
withId(R.id.imageView).clickBottomRight(offsetX = -30, offsetY = -30) | ||
withId(R.id.rB_bottom_right).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickBottomCenter() { | ||
withId(R.id.imageView).clickBottomCenter(offsetY = -30) | ||
withId(R.id.rB_bottom_center).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickBottomLeft() { | ||
withId(R.id.imageView).clickBottomLeft(offsetX = 30, offsetY = -30) | ||
withId(R.id.rB_bottom_left).isChecked() | ||
} | ||
|
||
@Test | ||
fun clickCenterLeft() { | ||
withId(R.id.imageView).clickCenterLeft(offsetX = 30) | ||
withId(R.id.rB_center_left).isChecked() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.atiurin.sampleapp"> | ||
package="com.atiurin.sampleapp"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<application | ||
android:requestLegacyExternalStorage="true" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
android:usesCleartextTraffic="true" | ||
> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.SplashActivity" | ||
android:theme="@style/SplashTheme"> | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:requestLegacyExternalStorage="true" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme" | ||
android:usesCleartextTraffic="true"> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.SplashActivity" | ||
android:theme="@style/SplashTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.MainActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
</activity> | ||
android:name="com.atiurin.sampleapp.activity.MainActivity" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
|
||
<activity | ||
android:name="com.atiurin.sampleapp.activity.ChatActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
</activity> | ||
android:name="com.atiurin.sampleapp.activity.ChatActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.LoginActivity" | ||
android:theme="@style/AppTheme"> | ||
</activity> | ||
android:name="com.atiurin.sampleapp.activity.LoginActivity" | ||
android:theme="@style/AppTheme" /> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.ProfileActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
</activity> | ||
android:name="com.atiurin.sampleapp.activity.ProfileActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.UiElementsActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
</activity> | ||
android:name="com.atiurin.sampleapp.activity.UiElementsActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.WebViewActivity" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
</activity> | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
<activity | ||
android:name="com.atiurin.sampleapp.activity.CustomClicksActivity" | ||
android:theme="@style/AppTheme.NoActionBar" /> | ||
</application> | ||
|
||
</manifest> |
12 changes: 12 additions & 0 deletions
12
sample-app/src/main/java/com/atiurin/sampleapp/activity/CustomClicksActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.atiurin.sampleapp.activity | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.atiurin.sampleapp.R | ||
|
||
class CustomClicksActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_custom_clicks) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
sample-app/src/main/res/layout/activity_custom_clicks.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/frameLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#123FE3" | ||
tools:context=".activity.CustomClicksActivity"> | ||
|
||
<ImageView | ||
android:id="@+id/imageView" | ||
android:layout_width="264dp" | ||
android:layout_height="285dp" | ||
android:layout_marginStart="72dp" | ||
android:layout_marginTop="128dp" | ||
android:adjustViewBounds="false" | ||
android:background="#FFFFFF" | ||
android:contentDescription="picture" | ||
android:visibility="visible" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:srcCompat="@drawable/background_splash" | ||
tools:srcCompat="@drawable/background_splash" /> | ||
|
||
<Button | ||
android:id="@+id/button" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="161dp" | ||
android:layout_marginTop="58dp" | ||
android:text="Button" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_top_left" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="72dp" | ||
android:layout_marginTop="128dp" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_center_left" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="216dp" | ||
android:layout_marginBottom="120dp" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintBottom_toBottomOf="@+id/imageView" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_bottom_left" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintBottom_toBottomOf="@+id/imageView" | ||
app:layout_constraintStart_toStartOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_top_right" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" | ||
app:layout_constraintTop_toTopOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_center_right" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="117dp" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" | ||
app:layout_constraintTop_toTopOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_bottom_right" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintBottom_toBottomOf="@+id/imageView" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_top_center" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginEnd="104dp" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" | ||
app:layout_constraintTop_toTopOf="@+id/imageView" /> | ||
|
||
<RadioButton | ||
android:id="@+id/rB_bottom_center" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="237dp" | ||
android:layout_marginEnd="104dp" | ||
android:backgroundTint="#DA1414" | ||
android:minWidth="48dp" | ||
android:minHeight="48dp" | ||
app:layout_constraintEnd_toEndOf="@+id/imageView" | ||
app:layout_constraintTop_toTopOf="@+id/imageView" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.