static int _testRemoveInvalidDirectory(void) {
  CharString c = newCharStringWithCString("invalid");
  assertFalse(removeDirectory(c));
  freeCharString(c);
  return 0;
}
Exemple #2
0
static void _programOptionSetCString(ProgramOption self, const char* value) {
  CharString valueString = newCharStringWithCString(value);
  _programOptionSetString(self, valueString);
  freeCharString(valueString);
}
static int _testGuessPluginPresetType(void) {
  CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
  assertIntEquals(pluginPresetGuessType(c), PRESET_TYPE_FXP);
  freeCharString(c);
  return 0;
}
static int _testGuessPluginPresetTypeInvalid(void) {
  CharString c = newCharStringWithCString("invalid");
  assertIntEquals(pluginPresetGuessType(c), PRESET_TYPE_INVALID);
  freeCharString(c);
  return 0;
}
TestSuite addIntegrationTests(File mrsWatsonExePath, File resourcesPath) {
  TestSuite testSuite = newTestSuite("Integration", NULL, NULL);
  testSuite->applicationPath =
      newCharStringWithCString(mrsWatsonExePath->absolutePath->data);
  testSuite->resourcesPath =
      newCharStringWithCString(resourcesPath->absolutePath->data);

  // Basic non-processing operations
  addTestWithPaths(testSuite, "List plugins", _testListPlugins);
  addTestWithPaths(testSuite, "List file types", _testListFileTypes);
  addTestWithPaths(testSuite, "Invalid arugment", _testInvalidArgument);

  // Plugin loading
  addTestWithPaths(testSuite, "Load plugin with absolute path",
                   _testLoadPluginWithAbsolutePath);

  // Invalid configurations
  addTestWithPaths(testSuite, "Run with no plugins", _testRunWithNoPlugins);
  addTestWithPaths(testSuite, "Effect with no input source",
                   _testEffectWithNoInputSource);
  addTestWithPaths(testSuite, "Instrument with no MIDI source",
                   _testInstrumentWithNoMidiSource);
  addTestWithPaths(testSuite, "Plugin chain with instrument not at head",
                   _testPluginChainWithInstrumentNotAtHead);
  addTestWithPaths(testSuite, "Plugin with invalid preset",
                   _testPluginWithInvalidPreset);
  addTestWithPaths(testSuite, "Preset for wrong plugin",
                   _testPresetForWrongPlugin);
  addTestWithPaths(testSuite, "Set invalid parameter",
                   _testSetInvalidParameter);
  addTestWithPaths(testSuite, "Set invalid time signature",
                   _testSetInvalidTimeSignature);
  addTestWithPaths(testSuite, "Set invalid tempo", _testSetInvalidTempo);
  addTestWithPaths(testSuite, "Set invalid blocksize",
                   _testSetInvalidBlocksize);
  addTestWithPaths(testSuite, "Set invalid bit depth", _testSetInvalidBitDepth);
  addTestWithPaths(testSuite, "Set invalid channel count",
                   _testSetInvalidChannelCount);
  addTestWithPaths(testSuite, "Set invalid sample rate",
                   _testSetInvalidSampleRate);

  // PCM files
  // TODO: Should add tests for other bit depths
  addTestWithPaths(testSuite, "Process 16-bit PCM file (mono)",
                   _testProcessPcmFile16BitMono);
  addTestWithPaths(testSuite, "Process 16-bit PCM file (stereo)",
                   _testProcessPcmFile16BitStereo);

  // WAVE files
  addTestWithPaths(testSuite, "Process 16-bit WAVE file (mono)",
                   _testProcessWaveFile16BitMono);
  addTestWithPaths(testSuite, "Process 16-bit WAVE file (stereo)",
                   _testProcessWaveFile16BitStereo);
  addTestWithPaths(testSuite, "Process 8-bit WAVE file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile8BitMono));
  addTestWithPaths(testSuite, "Process 8-bit WAVE file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile8BitStereo));
  addTestWithPaths(testSuite, "Process 24-bit WAVE file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile24BitMono));
  addTestWithPaths(testSuite, "Process 24-bit WAVE file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile24BitStereo));
  addTestWithPaths(testSuite, "Process 32-bit WAVE file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile32BitMono));
  addTestWithPaths(testSuite, "Process 32-bit WAVE file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessWaveFile32BitStereo));
  addTestWithPaths(testSuite, "Process FFMpeg WAVE file (stereo)",
                   _testProcessWaveFileFfmpeg);

  // AIFF files
  addTestWithPaths(testSuite, "Process 16-bit AIFF file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile16BitMono));
  addTestWithPaths(testSuite, "Process 16-bit AIFF file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile16BitStereo));
#if TEST_AIFF_BIT_DEPTHS
  // 8-bit AIFF will require some extra work in SampleSourceAudiofile
  addTestWithPaths(testSuite, "Process 8-bit AIFF file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile8BitMono));
  addTestWithPaths(testSuite, "Process 8-bit AIFF file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile8BitStereo));
  addTestWithPaths(testSuite, "Process 24-bit AIFF file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile24BitMono));
  addTestWithPaths(testSuite, "Process 24-bit AIFF file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile24BitStereo));
  // 32-bit AIFF will require some extra work in SampleSourceAudiofile
  addTestWithPaths(testSuite, "Process 32-bit AIFF file (mono)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile32BitMono));
  addTestWithPaths(testSuite, "Process 32-bit AIFF file (stereo)",
                   REQUIRES_AUDIOFILE(_testProcessAiffFile32BitStereo));
#endif

  // FLAC files
  addTestWithPaths(testSuite, "Process 8-bit FLAC file (mono)",
                   REQUIRES_FLAC(_testProcessFlacFile8BitMono));
  addTestWithPaths(testSuite, "Process 8-bit FLAC file (stereo)",
                   REQUIRES_FLAC(_testProcessFlacFile8BitStereo));
  addTestWithPaths(testSuite, "Process 16-bit FLAC file (mono)",
                   REQUIRES_FLAC(_testProcessFlacFile16BitMono));
  addTestWithPaths(testSuite, "Process 16-bit FLAC file (stereo)",
                   REQUIRES_FLAC(_testProcessFlacFile16BitStereo));
  addTestWithPaths(testSuite, "Process 24-bit FLAC file (mono)",
                   REQUIRES_FLAC(_testProcessFlacFile24BitMono));
  addTestWithPaths(testSuite, "Process 24-bit FLAC file (stereo)",
                   REQUIRES_FLAC(_testProcessFlacFile24BitStereo));
  addTestWithPaths(testSuite, "Process 32-bit FLAC file (mono)",
                   REQUIRES_FLAC(_testProcessFlacFile32BitMono));
  addTestWithPaths(testSuite, "Process 32-bit FLAC file (stereo)",
                   REQUIRES_FLAC(_testProcessFlacFile32BitStereo));

  // Audio settings
  addTestWithPaths(testSuite, "Process with sample rate",
                   _testProcessWithSampleRate);
  addTestWithPaths(testSuite, "Process with blocksize",
                   _testProcessWithBlocksize);
  addTestWithPaths(testSuite, "Process with time signature",
                   _testProcessWithTimeSignature);

  // Parameter tests
  addTestWithPaths(testSuite, "Set parameter", _testSetParameter);

  // Internal plugins
  addTestWithPaths(testSuite, "Internal limiter", _testInternalLimiter);
  addTestWithPaths(testSuite, "Internal gain plugin", _testInternalGainPlugin);
  addTestWithPaths(testSuite, "Internal gain plugin invalid parameter",
                   _testInternalGainPluginInvalidParameter);
  addTestWithPaths(testSuite, "Internal passthru plugin",
                   _testInternalPassthruPlugin);

#if TEST_SILENCE_PLUGIN
  addTestWithPaths(testSuite, "Internal silence generator",
                   _testInternalSilenceGenerator);
#endif

  // Plugin processing tests
  addTestWithPaths(testSuite, "Process audio with again plugin",
                   _testProcessWithAgainPlugin);
  addTestWithPaths(testSuite, "Process MIDI with vstxsynth plugin",
                   _testProcessWithVstxsynthPlugin);
  addTestWithPaths(testSuite, "Process effect chain", _testProcessEffectChain);
  addTestWithPaths(testSuite, "Load FXP preset in VST",
                   _testLoadFxpPresetInVst);
  addTestWithPaths(testSuite, "Load internal program in VST",
                   _testLoadInternalProgramInVst);

  return testSuite;
}
Exemple #6
0
void errorReporterInitialize(ErrorReporter self)
{
    CharString infoText = newCharStringWithCString(kErrorReportInfoText);
    CharString wrappedInfoText;
    time_t now;
    size_t length;
    size_t i;

    printf("=== Starting error report ===\n");
    wrappedInfoText = charStringWrap(infoText, 0);
    // The second newline here is intentional
    printf("%s\n", wrappedInfoText->data);

    time(&now);
    self->started = true;

    snprintf(self->reportName->data, self->reportName->capacity,
             "MrsWatson Report %s", ctime(&now));
    // Trim the final newline character from this string if it exists
    length = strlen(self->reportName->data);

    if (self->reportName->data[length - 1] == '\n') {
        self->reportName->data[length - 1] = '\0';
        length--;
    }

    for (i = 0; i < length; i++) {
        if (!(charStringIsLetter(self->reportName, i) ||
                charStringIsNumber(self->reportName, i))) {
            self->reportName->data[i] = '-';
        }
    }

#if UNIX
    snprintf(self->desktopPath->data, self->desktopPath->capacity,
             "%s/Desktop", getenv("HOME"));
#elif WINDOWS
    SHGetFolderPathA(NULL, CSIDL_DESKTOPDIRECTORY, NULL, 0, self->desktopPath->data);
#endif

    // Try to place the report on the user's desktop. However, if we cannot find
    // the desktop (which may occur with localized Linux installations, for instance),
    // then just dump it in the current directory instead.
    File desktopPath = newFileWithPath(self->desktopPath);
    File reportPath;

    if (!fileExists(desktopPath)) {
        logWarn("Could not find desktop location, placing error report in current directory instead");
        CharString currentDirString = fileGetCurrentDirectory();
        File currentDir = newFileWithPath(currentDirString);
        reportPath = newFileWithParent(currentDir, self->reportName);
        freeFile(currentDir);
        freeCharString(currentDirString);
    } else {
        reportPath = newFileWithParent(desktopPath, self->reportName);
        freeFile(desktopPath);
    }

    if (fileExists(reportPath)) {
        logCritical("The path '%s' already contains a previous error report. Please remove the report data and try again.");
    } else {
        fileCreate(reportPath, kFileTypeDirectory);
    }

    // Now we should have a real error report path
    charStringCopy(self->reportDirPath, reportPath->absolutePath);

    freeFile(reportPath);
    freeCharString(wrappedInfoText);
    freeCharString(infoText);
}