use of com.android.tools.idea.editors.theme.datamodels.EditedStyleItem in project android by JetBrains.
the class ThemeEditorUtilsTest method testGenerateToolTipText.
public void testGenerateToolTipText() throws IOException {
if (SystemInfo.isWindows) {
// Do not run tests on Windows (see http://b.android.com/222904)
return;
}
VirtualFile myFile = myFixture.copyFileToProject("themeEditor/styles_1.xml", "res/values/styles.xml");
myFixture.copyFileToProject("themeEditor/attrs.xml", "res/values/attrs.xml");
Configuration configuration = myFacet.getConfigurationManager().getConfiguration(myFile);
IAndroidTarget androidTarget = configuration.getTarget();
assertNotNull(androidTarget);
sdkPlatformPath = androidTarget.getLocation();
if (LayoutLibraryLoader.USE_SDK_LAYOUTLIB) {
if (!sdkPlatformPath.endsWith("/"))
sdkPlatformPath += "/";
sdkPlatformPath += "platforms/android-" + androidTarget.getVersion().getApiString();
}
sdkPlatformPath = Files.simplifyPath(sdkPlatformPath);
ThemeResolver themeResolver = new ThemeResolver(configuration);
ConfiguredThemeEditorStyle theme = themeResolver.getTheme("AppTheme");
assertNotNull(theme);
Collection<EditedStyleItem> values = ThemeEditorTestUtils.getStyleLocalValues(theme);
assertEquals(7, values.size());
configuration.setTheme("AppTheme");
for (EditedStyleItem item : values) {
String doc = ThemeEditorUtils.generateToolTipText(item.getSelectedValue(), myModule, configuration);
compareWithGoldenFile(doc, myFixture.getTestDataPath() + "/themeEditor/tooltipDocAns/" + item.getName() + ".ans");
}
}
use of com.android.tools.idea.editors.theme.datamodels.EditedStyleItem in project android by JetBrains.
the class AttributesGrouperTest method fromList.
/**
* Creates a list of {@link EditedStyleItem} mocks from the given list of pairs (attribute name, attribute group)
*/
@NotNull
private static List<EditedStyleItem> fromList(String... args) {
assert args.length % 2 == 0;
ImmutableList.Builder<EditedStyleItem> builder = ImmutableList.builder();
for (int i = 0; i < args.length; i += 2) {
String attributeName = args[i];
String attributeGroup = args[i + 1];
EditedStyleItem styleItem = mock(EditedStyleItem.class);
when(styleItem.getName()).thenReturn(attributeName);
when(styleItem.getAttrGroup()).thenReturn(attributeGroup);
builder.add(styleItem);
}
return builder.build();
}
Aggregations