use of org.intellij.lang.annotations.Language in project android by JetBrains.
the class LombokPsiConverterTest method test.
public void test() {
//noinspection MethodMayBeStatic,ForLoopReplaceableByWhile,ConstantConditions,InfiniteLoopStatement
@Language("JAVA") String testClass = "package test.pkg;\n" + "\n" + "import android.annotation.SuppressLint;\n" + "import android.annotation.TargetApi;\n" + "import android.os.Build;\n" + "\n" + "public class EmptyStatementTest {\n" + " public final View test(View start, Predicate<View> predicate) {\n" + " View childToSkip = null;\n" + " for (;;) {\n" + " View view = start.findViewByPredicateTraversal(predicate, childToSkip);\n" + " }\n" + " }\n" + "}\n";
PsiFile file = myFixture.addFileToProject("src/test/pkg/SuppressTest.java", testClass);
check(file, testClass);
}
use of org.intellij.lang.annotations.Language in project android by JetBrains.
the class LombokPsiConverterTest method testPsiToLombokConversion6.
public void testPsiToLombokConversion6() {
@Language("JAVA") String testClass = "package test.pkg;\n" + "import java.util.HashMap;\n" + "\n" + "/* This stub is for using by IDE only. It is NOT the Manifest class actually packed into APK */\n" + "public final class Wildcards {\n" + " HashMap<Integer, Integer> s4 = new HashMap<Integer, Integer>();\n" + "}";
PsiFile file = myFixture.addFileToProject("src/test/pkg/Wildcards.java", testClass);
check(file, testClass);
}
use of org.intellij.lang.annotations.Language in project android by JetBrains.
the class LombokPsiConverterTest method testSuper.
public void testSuper() {
@Language("JAVA") String testClass = "package test.pkg;\n" + "\n" + "public final class R8 {\n" + " public String toString() {\n" + " return super.toString();\n" + " }\n" + "}";
PsiFile file = myFixture.addFileToProject("src/test/pkg/R8.java", testClass);
check(file, testClass);
}
use of org.intellij.lang.annotations.Language in project android by JetBrains.
the class LombokPsiConverterTest method testInterface.
public void testInterface() {
@Language("JAVA") String testClass = "package test.pkg;\n" + "public interface R11 {\n" + " int call();\n" + "}";
PsiFile file = myFixture.addFileToProject("src/test/pkg/R10.java", testClass);
check(file, testClass);
}
use of org.intellij.lang.annotations.Language in project android by JetBrains.
the class AbsoluteLayoutHandlerTest method testDragToLayout2.
public void testDragToLayout2() throws Exception {
// Drag from one layout to another
ModelBuilder builder = model("absolute3.xml", component(LINEAR_LAYOUT).withBounds(0, 0, 1000, 1000).matchParentWidth().matchParentHeight().withAttribute(ANDROID_URI, ATTR_ORIENTATION, VALUE_VERTICAL).children(component(ABSOLUTE_LAYOUT).withBounds(0, 0, 1000, 850).id("myAbsLayout").matchParentWidth().height("0dp").withAttribute(ANDROID_URI, ATTR_LAYOUT_WEIGHT, VALUE_1), component(TEXT_VIEW).withBounds(0, 850, 1000, 150).id("@id/myText").width("1000px").height("150px")));
@Language("XML") String xml = "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"match_parent\"\n" + " android:orientation=\"vertical\">\n" + "\n" + " <AbsoluteLayout\n" + " android:id=\"myAbsLayout\"\n" + " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"0dp\"\n" + " android:layout_weight=\"1\"/>\n" + "\n" + " <TextView\n" + " android:id=\"@id/myText\"\n" + " android:layout_width=\"1000px\"\n" + " android:layout_height=\"150px\"/>\n" + "\n" + "</LinearLayout>\n";
assertEquals(xml, builder.toXml());
final NlModel model = builder.build();
assertEquals(1, model.getComponents().size());
assertEquals("NlComponent{tag=<LinearLayout>, bounds=[0,0:1000x1000}\n" + " NlComponent{tag=<AbsoluteLayout>, bounds=[0,0:1000x850}\n" + " NlComponent{tag=<TextView>, bounds=[0,850:1000x150}", NlTreeDumper.dumpTree(model.getComponents()));
surface().screen(model).get("@id/myText").drag().drag(50, // into AbsoluteLayout sibling
-300).release().primary().parent().parent().expectXml("<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"match_parent\"\n" + " android:orientation=\"vertical\">\n" + "\n" + " <AbsoluteLayout\n" + " android:id=\"myAbsLayout\"\n" + " android:layout_width=\"match_parent\"\n" + " android:layout_height=\"0dp\"\n" + " android:layout_weight=\"1\">\n" + "\n" + " <TextView\n" + " android:id=\"@id/myText\"\n" + " android:layout_width=\"1000px\"\n" + " android:layout_height=\"150px\"\n" + " android:layout_x=\"50dp\"\n" + " android:layout_y=\"550dp\" />\n" + " </AbsoluteLayout>\n" + "\n" + "</LinearLayout>");
}
Aggregations