Search in sources :

Example 81 with Language

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);
}
Also used : Language(org.intellij.lang.annotations.Language) PsiFile(com.intellij.psi.PsiFile)

Example 82 with Language

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);
}
Also used : Language(org.intellij.lang.annotations.Language) PsiFile(com.intellij.psi.PsiFile)

Example 83 with Language

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);
}
Also used : Language(org.intellij.lang.annotations.Language) PsiFile(com.intellij.psi.PsiFile)

Example 84 with Language

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);
}
Also used : Language(org.intellij.lang.annotations.Language) PsiFile(com.intellij.psi.PsiFile)

Example 85 with Language

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>");
}
Also used : ModelBuilder(com.android.tools.idea.uibuilder.fixtures.ModelBuilder) Language(org.intellij.lang.annotations.Language) NlModel(com.android.tools.idea.uibuilder.model.NlModel)

Aggregations

Language (org.intellij.lang.annotations.Language)111 TableMetadata (com.facebook.presto.metadata.TableMetadata)25 Test (org.testng.annotations.Test)24 MaterializedResult (com.facebook.presto.testing.MaterializedResult)19 PsiFile (com.intellij.psi.PsiFile)18 MaterializedRow (com.facebook.presto.testing.MaterializedRow)11 List (java.util.List)11 Optional (java.util.Optional)11 Test (org.junit.Test)11 ImmutableList (com.google.common.collect.ImmutableList)10 Session (com.facebook.presto.Session)9 Constraint (com.facebook.presto.spi.Constraint)9 AbstractTestIntegrationSmokeTest (com.facebook.presto.tests.AbstractTestIntegrationSmokeTest)9 BasePlanTest (com.facebook.presto.sql.planner.assertions.BasePlanTest)8 ColumnConstraint (com.facebook.presto.sql.planner.planPrinter.IOPlanPrinter.ColumnConstraint)8 ImmutableMap (com.google.common.collect.ImmutableMap)8 ColumnMetadata (com.facebook.presto.spi.ColumnMetadata)7 ExpectedValueProvider (com.facebook.presto.sql.planner.assertions.ExpectedValueProvider)7 PlanMatchPattern (com.facebook.presto.sql.planner.assertions.PlanMatchPattern)7 SortOrder (com.facebook.presto.common.block.SortOrder)6