aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2015-07-27 16:27:12 -0700
committerAdnan Begovic <adnan@cyngn.com>2015-07-31 13:05:32 -0700
commit25daf555d20557ee75f12eae59cc699120e9a831 (patch)
treefaefc92a577941657476d9cb864aef1540ac815e /tests
parentd61839701e49f3b945ff7318824369f37d272132 (diff)
downloadvendor_cmsdk-25daf555d20557ee75f12eae59cc699120e9a831.zip
vendor_cmsdk-25daf555d20557ee75f12eae59cc699120e9a831.tar.gz
vendor_cmsdk-25daf555d20557ee75f12eae59cc699120e9a831.tar.bz2
cmsdk: Add functional manual and unit tests for new setIcon
Change-Id: Ia0f83c76429f80a7b7a4216e0cdf7d71844b9b64
Diffstat (limited to 'tests')
-rw-r--r--tests/res/drawable-hdpi/ic_whatshot_white_24dp.pngbin0 -> 468 bytes
-rw-r--r--tests/res/drawable-mdpi/ic_whatshot_white_24dp.pngbin0 -> 334 bytes
-rw-r--r--tests/res/drawable-xhdpi/ic_whatshot_white_24dp.pngbin0 -> 595 bytes
-rw-r--r--tests/res/drawable-xxhdpi/ic_whatshot_white_24dp.pngbin0 -> 866 bytes
-rw-r--r--tests/res/drawable-xxxhdpi/ic_whatshot_white_24dp.pngbin0 -> 1129 bytes
-rw-r--r--tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java94
-rw-r--r--tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java14
7 files changed, 108 insertions, 0 deletions
diff --git a/tests/res/drawable-hdpi/ic_whatshot_white_24dp.png b/tests/res/drawable-hdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000..46ed1f8
--- /dev/null
+++ b/tests/res/drawable-hdpi/ic_whatshot_white_24dp.png
Binary files differ
diff --git a/tests/res/drawable-mdpi/ic_whatshot_white_24dp.png b/tests/res/drawable-mdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000..4cf6f85
--- /dev/null
+++ b/tests/res/drawable-mdpi/ic_whatshot_white_24dp.png
Binary files differ
diff --git a/tests/res/drawable-xhdpi/ic_whatshot_white_24dp.png b/tests/res/drawable-xhdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000..3651d06
--- /dev/null
+++ b/tests/res/drawable-xhdpi/ic_whatshot_white_24dp.png
Binary files differ
diff --git a/tests/res/drawable-xxhdpi/ic_whatshot_white_24dp.png b/tests/res/drawable-xxhdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000..8eaf375
--- /dev/null
+++ b/tests/res/drawable-xxhdpi/ic_whatshot_white_24dp.png
Binary files differ
diff --git a/tests/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png b/tests/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png
new file mode 100644
index 0000000..5c5d868
--- /dev/null
+++ b/tests/res/drawable-xxxhdpi/ic_whatshot_white_24dp.png
Binary files differ
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
index 3319f62..904bc3d 100644
--- a/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
+++ b/tests/src/org/cyanogenmod/tests/customtiles/CMStatusBarTest.java
@@ -18,6 +18,8 @@ package org.cyanogenmod.tests.customtiles;
import android.app.PendingIntent;
import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Handler;
@@ -66,6 +68,25 @@ public class CMStatusBarTest extends TestActivity {
}
},
+ new Test("test publish tile with bitmap") {
+ public void run() {
+ int resourceInt = R.drawable.ic_whatshot_white_24dp;
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
+ resourceInt);
+ PendingIntent intent = PendingIntent.getActivity(CMStatusBarTest.this, 0,
+ new Intent(CMStatusBarTest.this, CMStatusBarTest.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
+ mCustomTile = new CustomTile.Builder(CMStatusBarTest.this)
+ .setLabel("Test From SDK - remote icon")
+ .setIcon(bitmap)
+ .setOnClickIntent(intent)
+ .shouldCollapsePanel(true)
+ .setContentDescription("Content description")
+ .build();
+ mCMStatusBarManager.publishTile(CUSTOM_TILE_ID, mCustomTile);
+ }
+ },
+
new Test("test publish tile in 3 seconds") {
public void run() {
mHandler.postDelayed(new Runnable() {
@@ -171,6 +192,43 @@ public class CMStatusBarTest extends TestActivity {
}
},
+ new Test("test publish tile with expanded list with bitmaps") {
+ public void run() {
+ PendingIntent intent = PendingIntent.getActivity(CMStatusBarTest.this, 0,
+ new Intent(CMStatusBarTest.this, CMStatusBarTest.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
+ ArrayList<CustomTile.ExpandedListItem> expandedListItems =
+ new ArrayList<CustomTile.ExpandedListItem>();
+ int resourceInt = R.drawable.ic_whatshot_white_24dp;
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
+ resourceInt);
+ for (int i = 0; i < 20; i++) {
+ CustomTile.ExpandedListItem expandedListItem =
+ new CustomTile.ExpandedListItem();
+ expandedListItem.setExpandedListItemBitmap(bitmap);
+ expandedListItem.setExpandedListItemTitle("Test: " + i);
+ expandedListItem.setExpandedListItemSummary("Test item summary " + i);
+ expandedListItem.setExpandedListItemOnClickIntent(intent);
+ expandedListItems.add(expandedListItem);
+ }
+
+ CustomTile.ListExpandedStyle listExpandedStyle =
+ new CustomTile.ListExpandedStyle();
+ listExpandedStyle.setListItems(expandedListItems);
+ CustomTile customTile = new CustomTile.Builder(CMStatusBarTest.this)
+ .setLabel("Test Expanded List Style From SDK")
+ .setIcon(R.drawable.ic_launcher)
+ .setExpandedStyle(listExpandedStyle)
+ .setOnSettingsClickIntent(new Intent(CMStatusBarTest.this,
+ DummySettings.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
+ .setContentDescription("Content description")
+ .build();
+ CMStatusBarManager.getInstance(CMStatusBarTest.this)
+ .publishTile(CUSTOM_TILE_SETTINGS_ID, customTile);
+ }
+ },
+
new Test("test publish tile with expanded grid") {
public void run() {
PendingIntent intent = PendingIntent.getActivity(CMStatusBarTest.this, 0,
@@ -202,6 +260,42 @@ public class CMStatusBarTest extends TestActivity {
CMStatusBarManager.getInstance(CMStatusBarTest.this)
.publishTile(CUSTOM_TILE_SETTINGS_ID, customTile);
}
+ },
+
+ new Test("test publish tile with expanded grid with bitmaps") {
+ public void run() {
+ PendingIntent intent = PendingIntent.getActivity(CMStatusBarTest.this, 0,
+ new Intent(CMStatusBarTest.this, CMStatusBarTest.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
+ ArrayList<CustomTile.ExpandedGridItem> expandedGridItems =
+ new ArrayList<CustomTile.ExpandedGridItem>();
+ int resourceInt = R.drawable.ic_whatshot_white_24dp;
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
+ resourceInt);
+ for (int i = 0; i < 8; i++) {
+ CustomTile.ExpandedGridItem expandedGridItem =
+ new CustomTile.ExpandedGridItem();
+ expandedGridItem.setExpandedGridItemBitmap(bitmap);
+ expandedGridItem.setExpandedGridItemTitle("Test: " + i);
+ expandedGridItem.setExpandedGridItemOnClickIntent(intent);
+ expandedGridItems.add(expandedGridItem);
+ }
+
+ CustomTile.GridExpandedStyle gridExpandedStyle =
+ new CustomTile.GridExpandedStyle();
+ gridExpandedStyle.setGridItems(expandedGridItems);
+ CustomTile customTile = new CustomTile.Builder(CMStatusBarTest.this)
+ .setLabel("Test Expanded Grid Style From SDK")
+ .setIcon(R.drawable.ic_launcher)
+ .setExpandedStyle(gridExpandedStyle)
+ .setOnSettingsClickIntent(new Intent(CMStatusBarTest.this,
+ DummySettings.class)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
+ .setContentDescription("Content description")
+ .build();
+ CMStatusBarManager.getInstance(CMStatusBarTest.this)
+ .publishTile(CUSTOM_TILE_SETTINGS_ID, customTile);
+ }
}
};
}
diff --git a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
index f2a5e31..93bd132 100644
--- a/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
+++ b/tests/src/org/cyanogenmod/tests/customtiles/unit/CustomTileBuilderTest.java
@@ -18,6 +18,8 @@ package org.cyanogenmod.tests.customtiles.unit;
import android.app.PendingIntent;
import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.net.Uri;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -107,6 +109,18 @@ public class CustomTileBuilderTest extends AndroidTestCase {
}
@SmallTest
+ public void testCustomTileBuilderRemoteIconSet() {
+ int resourceInt = R.drawable.ic_whatshot_white_24dp;
+ Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(),
+ resourceInt);
+ CustomTile customTile = new CustomTile.Builder(mContext)
+ .setIcon(bitmap)
+ .build();
+ assertNotNull(customTile.remoteIcon);
+ assertEquals(bitmap, customTile.remoteIcon);
+ }
+
+ @SmallTest
public void testCustomTileBuilderCollapsePanelSet() {
boolean collapsePanel = true;
CustomTile customTile = new CustomTile.Builder(mContext)