Ejemplo n.º 1
0
 @Override
 protected void doCommitModel(@NotNull final ModifiableRootModel rootModel) {
   super.doCommitModel(rootModel);
   FlexTestUtils.setupFlexLib(myProject, getClass(), getTestName(false));
   if (myAfterCommitRunnable != null) {
     myAfterCommitRunnable.run();
   }
 }
  @Override
  protected void doCommitModel(@NotNull ModifiableRootModel rootModel) {
    super.doCommitModel(rootModel);

    FlexTestUtils.addFlexUnitLib(
        getClass(),
        getTestName(false),
        getModule(),
        getTestDataPath(),
        FLEX_UNIT_0_9_SWC,
        FLEX_UNIT_4_SWC);
  }
Ejemplo n.º 3
0
  public void testModuleConflicts() throws Exception {
    final Module module2 = doCreateRealModule("module2");
    final VirtualFile contentRoot =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getTestRoot() + getTestName(false) + "/module2");
    PsiTestUtil.addSourceRoot(module2, contentRoot);
    FlexTestUtils.addFlexModuleDependency(myModule, module2);

    String[] conflicts =
        new String[] {
          "Class A, referenced in method Sub.foo(A), will not be accessible in module module2"
        };
    doTestConflicts("Sub", "ISuper", DocCommentPolicy.ASIS, conflicts, "foo");
  }
Ejemplo n.º 4
0
  @JSTestOptions({JSTestOption.WithFlexFacet, JSTestOption.WithLineMarkers})
  public void testLineMarkersInSwf() throws Exception {
    myAfterCommitRunnable =
        () ->
            FlexTestUtils.addLibrary(
                myModule,
                "lib",
                getTestDataPath() + getBasePath() + "/",
                getTestName(false) + ".swc",
                null,
                null);
    configureByFiles((String) null);
    VirtualFile vFile =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".swc");
    vFile = JarFileSystem.getInstance().getJarRootForLocalFile(vFile).findChild("library.swf");
    myEditor =
        FileEditorManager.getInstance(myProject)
            .openTextEditor(new OpenFileDescriptor(myProject, vFile, 0), false);
    PsiDocumentManager.getInstance(getProject()).commitAllDocuments();

    myFile = myPsiManager.findFile(vFile);
    ((EditorImpl) myEditor).setCaretActive();

    vFile =
        LocalFileSystem.getInstance()
            .findFileByPath(getTestDataPath() + getBasePath() + "/" + getTestName(false) + ".as");
    myFile = myPsiManager.findFile(vFile);
    checkHighlighting(
        new ExpectedHighlightingData(
            new DocumentImpl(StreamUtil.convertSeparators(VfsUtil.loadText(vFile))),
            false,
            false,
            true,
            myFile));
  }
 @NotNull
 @Override
 protected String getTestDataPath() {
   return FlexTestUtils.getTestDataPath("refactoring/introduceVariable/");
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   FlexTestUtils.setupFlexSdk(myModule, getTestName(false), getClass());
 }
Ejemplo n.º 7
0
  public static VirtualFile[] configureByFiles(
      @Nullable VirtualFile rawProjectRoot,
      VirtualFile[] files,
      @Nullable VirtualFile[] auxiliaryFiles,
      Module module,
      @Nullable
          TripleFunction<ModifiableRootModel, VirtualFile, List<String>, Void> moduleInitializer)
      throws Exception {
    return WriteAction.compute(
        () -> {
          VirtualFile dummyRoot = VirtualFileManager.getInstance().findFileByUrl("temp:///");
          //noinspection ConstantConditions
          dummyRoot.refresh(false, false);
          final VirtualFile sourceDir = dummyRoot.createChildDirectory(DesignerTests.class, "s");
          assert sourceDir != null;

          final IndexableFileSet indexableFileSet =
              new IndexableFileSet() {
                @Override
                public boolean isInSet(@NotNull final VirtualFile file) {
                  return file.getFileSystem() == sourceDir.getFileSystem();
                }

                @Override
                public void iterateIndexableFilesIn(
                    @NotNull final VirtualFile file, @NotNull final ContentIterator iterator) {
                  if (file.isDirectory()) {
                    for (VirtualFile child : file.getChildren()) {
                      iterateIndexableFilesIn(child, iterator);
                    }
                  } else {
                    iterator.processFile(file);
                  }
                }
              };
          FileBasedIndex.getInstance().registerIndexableSet(indexableFileSet, module.getProject());

          Disposer.register(
              module,
              new Disposable() {
                @Override
                public void dispose() {
                  FileBasedIndex.getInstance().removeIndexableSet(indexableFileSet);
                  ApplicationManager.getApplication()
                      .runWriteAction(
                          () -> {
                            try {
                              sourceDir.delete(null);
                            } catch (IOException e) {
                              throw new RuntimeException(e);
                            }
                          });
                }
              });

          final ModifiableRootModel rootModel =
              ModuleRootManager.getInstance(module).getModifiableModel();

          VirtualFile[] toFiles = copyFiles(files, sourceDir, rawProjectRoot);
          if (auxiliaryFiles != null) {
            copyFiles(auxiliaryFiles, sourceDir, rawProjectRoot);
          }

          rootModel.addContentEntry(sourceDir).addSourceFolder(sourceDir, false);
          final List<String> libs = new ArrayList<>();
          if (moduleInitializer != null) {
            moduleInitializer.fun(rootModel, sourceDir, libs);
          }
          rootModel.commit();

          for (String path : libs) {
            VirtualFile virtualFile = path.charAt(0) != '/' ? getFile("lib", path) : getFile(path);
            FlexTestUtils.addLibrary(
                module, path, virtualFile.getParent().getPath(), virtualFile.getName(), null, null);
          }
          return toFiles;
        });
  }
 @Override
 protected void setUpJdk() {
   FlexTestUtils.setupFlexSdk(myModule, getTestName(false), getClass());
 }
 @Override
 protected String getTestDataPath() {
   return FlexTestUtils.getTestDataPath("flexUnit");
 }
Ejemplo n.º 10
0
 @Override
 protected String getTestDataPath() {
   return FlexTestUtils.getTestDataPath(FlexHighlightingTest.BASE_PATH);
 }
 @Override
 protected String getTestDataPath() {
   return FlexTestUtils.getTestDataPath("statementMover/");
 }