Add tests for the custom toot character limit functionality (#599)

* Query instance for toot character limit
Fixes #393

* Move maximumTootCharacters to instance field

* Add caching for maximum toot characters, expanding on the emoji list storage

* Update formatting per review feedback

* Fix compose activity tests

* Rename mastodon api point for nicer interaction with kotlin

* Default emoji list to empty list instead of null, to appease json converters in failure cases

* Add test coverage for custom toot character limit setting

* Fix compiler warnings
This commit is contained in:
Levi Bard 2018-04-29 10:08:25 +02:00 committed by Konrad Pozniak
commit ff7c54e739
2 changed files with 84 additions and 5 deletions

View file

@ -147,7 +147,7 @@ public final class ComposeActivity
Injectable, InputConnectionCompat.OnCommitContentListener {
private static final String TAG = "ComposeActivity"; // logging tag
private static final int STATUS_CHARACTER_LIMIT = 500;
static final int STATUS_CHARACTER_LIMIT = 500;
private static final int STATUS_MEDIA_SIZE_LIMIT = 8388608; // 8MiB
private static final int MEDIA_PICK_RESULT = 1;
private static final int MEDIA_TAKE_PHOTO_RESULT = 2;
@ -1464,6 +1464,12 @@ public final class ComposeActivity
TuskyApplication.getDB().instanceDao().insertOrReplace(instanceEntity);
}
// Accessors for testing, hence package scope
int getMaximumTootCharacters()
{
return maximumTootCharacters;
}
public static final class QueuedMedia {
Type type;
ProgressImageView preview;