-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fix fallback again in master (#3280)
* Fix issue introduced by column fallback * Add test for feature registration
- Loading branch information
1 parent
da79c45
commit 95bfaec
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...ards/src/androidTest/java/io/adaptivecards/objectmodel/FeatureRegistrationRenderTest.java
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,64 @@ | ||
package io.adaptivecards.objectmodel; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.test.mock.MockContext; | ||
import android.widget.LinearLayout; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.Test; | ||
|
||
import io.adaptivecards.renderer.AdaptiveCardRenderer; | ||
import io.adaptivecards.renderer.RenderedAdaptiveCard; | ||
import io.adaptivecards.renderer.registration.CardRendererRegistration; | ||
|
||
public class FeatureRegistrationRenderTest | ||
{ | ||
|
||
static { | ||
System.loadLibrary("adaptivecards-native-lib"); | ||
} | ||
|
||
@Test | ||
public void TestDefaultRendering() throws Exception | ||
{ | ||
final String cardJson = | ||
"{\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\"," + | ||
"\"type\": \"AdaptiveCard\"," + | ||
"\"version\": \"1.0\"," + | ||
"\"body\": [{\"type\": \"TextBlock\",\"text\": \"This is some text\"}]" + | ||
"}"; | ||
|
||
HostConfig hostConfig = new HostConfig(); | ||
|
||
ParseContext parseContext = new ParseContext(); | ||
ParseResult parseResult = AdaptiveCard.DeserializeFromString(cardJson, AdaptiveCardRenderer.VERSION, parseContext); | ||
Context context = InstrumentationRegistry.getTargetContext(); | ||
AdaptiveCardRenderer.getInstance().render(context, null, parseResult.GetAdaptiveCard(), null, hostConfig); | ||
} | ||
|
||
@Test | ||
public void TestFeatureRegistrationRendering() throws Exception | ||
{ | ||
final String cardJson = | ||
"{\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\"," + | ||
"\"type\": \"AdaptiveCard\"," + | ||
"\"version\": \"1.0\"," + | ||
"\"body\": [{\"type\": \"TextBlock\",\"text\": \"This is some text\"}]" + | ||
"}"; | ||
|
||
HostConfig hostConfig = new HostConfig(); | ||
|
||
ParseContext parseContext = new ParseContext(); | ||
ParseResult parseResult = AdaptiveCard.DeserializeFromString(cardJson, AdaptiveCardRenderer.VERSION, parseContext); | ||
Context context = InstrumentationRegistry.getTargetContext(); | ||
|
||
FeatureRegistration featureRegistration = new FeatureRegistration(); | ||
featureRegistration.AddFeature("featureName", "1.0"); | ||
CardRendererRegistration.getInstance().registerFeatureRegistration(featureRegistration); | ||
|
||
AdaptiveCardRenderer.getInstance().render(context, null, parseResult.GetAdaptiveCard(), null, hostConfig); | ||
} | ||
|
||
} |
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