mirror of
https://codeberg.org/armin/monoslicer.git
synced 2026-11-20 13:07:56 +01:00
Normalise file:// URLs for drag-and-drop loading
This commit is contained in:
parent
16322a2bb6
commit
6a8d2aa84d
2 changed files with 51 additions and 11 deletions
|
|
@ -164,6 +164,10 @@ MonoslicerProcessor processor;
|
|||
|
||||
std::cout << "\n\033[1mAcceptance\033[0m\n";
|
||||
check (editor.isInterestedInFileDrag ({ path }), "accepts a .wav file");
|
||||
check (editor.isInterestedInFileDrag ({ juce::String ("file://") + path }),
|
||||
"accepts a .wav file via a file:// URL");
|
||||
check (editor.isInterestedInFileDrag ({ "file:///tmp/foo%20bar.wav" }),
|
||||
"accepts a percent-encoded file:// URL");
|
||||
check (editor.isInterestedInFileDrag ({ "/tmp/notes.txt" }) == false, "rejects a .txt file");
|
||||
// The old hardcoded list only accepted ".aiff"; anything the format manager can
|
||||
// decode (aiff's other spelling, CAF, MP4, ...) is now accepted too.
|
||||
|
|
@ -219,6 +223,16 @@ MonoslicerProcessor processor;
|
|||
// Note: dropping does not auto-slice - that is a separate explicit action,
|
||||
// and matches the behaviour of the "Load" button.
|
||||
|
||||
std::cout << "\n\033[1mFile drop via file:// URL\033[0m\n";
|
||||
processor.clearSample();
|
||||
check (processor.getSampleBuffer().getNumSamples() == 0, "the sample was cleared");
|
||||
|
||||
editor.filesDropped ({ juce::String ("file://") + path }, info.position.x, info.position.y);
|
||||
check (processor.getSampleBuffer().getNumSamples() == 4096,
|
||||
"a file:// URL dropped as a file loads the sample");
|
||||
check (processor.getCurrentFile() == wavFile,
|
||||
"the file:// dropped file is recorded as the current file");
|
||||
|
||||
std::cout << "\n\033[1mText drop\033[0m\n";
|
||||
editor.textDropped (path, info.position.x, info.position.y);
|
||||
check (processor.getSampleBuffer().getNumSamples() == 4096,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue