aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-01-14 09:44:13 -0800
committerRoman Birg <roman@cyngn.com>2016-01-18 10:31:08 -0800
commit8d4920022f5b09a07e257fdf61a102a140c2f267 (patch)
tree5c0f1934fba2c17d2026bb25ceaedcf243ef832e /tests
parent5400b2f30e16fefb5260aaa0b4e69c1b1cb104bb (diff)
downloadvendor_cmsdk-8d4920022f5b09a07e257fdf61a102a140c2f267.zip
vendor_cmsdk-8d4920022f5b09a07e257fdf61a102a140c2f267.tar.gz
vendor_cmsdk-8d4920022f5b09a07e257fdf61a102a140c2f267.tar.bz2
CustomTiles: add a custom long press PendingIntent
Ref: CYNGNOS-1602 Change-Id: Id0cca88fabb091dcf0fbad2ae24416fa1c0af83e Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java15
-rw-r--r--tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java11
-rw-r--r--tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java23
3 files changed, 49 insertions, 0 deletions
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
index 20c9809..38ddca8 100644
--- a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
+++ b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
@@ -148,6 +148,21 @@ public class CMStatusBarTest extends TestActivity {
}
},
+ new Test("test publish tile with long press") {
+ public void run() {
+ CustomTile customTile = new CustomTile.Builder(CMStatusBarTest.this)
+ .setLabel("Test Long press From SDK")
+ .setIcon(R.drawable.ic_launcher)
+ .setOnLongClickIntent(PendingIntent.getActivity(CMStatusBarTest.this, 0,
+ new Intent(CMStatusBarTest.this,DummySettings.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0))
+ .setContentDescription("Content description")
+ .build();
+ CMStatusBarManager.getInstance(CMStatusBarTest.this)
+ .publishTile(CUSTOM_TILE_SETTINGS_ID, customTile);
+ }
+ },
+
new Test("test publish tile with delete intent") {
public void run() {
Intent intent = new Intent(CMStatusBarTest.this, DummySettings.class);
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
index 128ef77..5d20136 100644
--- a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
+++ b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
@@ -58,6 +58,17 @@ public class CustomTileBuilderTest extends AndroidTestCase {
}
@SmallTest
+ public void testCustomTileBuilderOnLongClickIntent() {
+ Intent intent = new Intent(Intent.ACTION_DIAL);
+ PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
+ CustomTile customTile = new CustomTile.Builder(mContext)
+ .setOnLongClickIntent(pendingIntent)
+ .build();
+ assertNotNull(customTile.onLongClick);
+ assertEquals(pendingIntent, customTile.onLongClick);
+ }
+
+ @SmallTest
public void testCustomTileBuilderOnSettingsClickIntent() {
Intent intent = new Intent(mContext, DummySettings.class);
CustomTile customTile = new CustomTile.Builder(mContext)
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java
index b724550..ca04f56 100644
--- a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java
+++ b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileTest.java
@@ -65,6 +65,29 @@ public class CustomTileTest extends AndroidTestCase {
}
@SmallTest
+ public void testCustomTileOnLongiClickIntentUnravelFromParcel() {
+ Intent intent = new Intent(Intent.ACTION_DIAL);
+ PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
+ CustomTile expectedCustomTile = new CustomTile.Builder(mContext)
+ .setOnLongClickIntent(pendingIntent)
+ .build();
+
+ // Write to parcel
+ Parcel parcel = Parcel.obtain();
+ expectedCustomTile.writeToParcel(parcel, 0);
+
+ // Rewind
+ parcel.setDataPosition(0);
+
+ // Verify data when unraveling
+ CustomTile fromParcel = CustomTile.CREATOR.createFromParcel(parcel);
+
+ assertNotNull(fromParcel.onLongClick);
+ assertEquals(expectedCustomTile.onLongClick.getIntent().toString(),
+ fromParcel.onLongClick.getIntent().toString());
+ }
+
+ @SmallTest
public void testCustomTileOnSettingsClickIntentUnravelFromParcel() {
Intent intent = new Intent(mContext, DummySettings.class);
CustomTile expectedCustomTile = new CustomTile.Builder(mContext)