| 1035 | {} |
| 1036 | |
| 1037 | void runTest() override |
| 1038 | { |
| 1039 | beginTest ("Reading"); |
| 1040 | |
| 1041 | const File home (File::getSpecialLocation (File::userHomeDirectory)); |
| 1042 | const File temp (File::getSpecialLocation (File::tempDirectory)); |
| 1043 | |
| 1044 | expect (! File().exists()); |
| 1045 | expect (! File().existsAsFile()); |
| 1046 | expect (! File().isDirectory()); |
| 1047 | #if ! JUCE_WINDOWS |
| 1048 | expect (File("/").isDirectory()); |
| 1049 | #endif |
| 1050 | expect (home.isDirectory()); |
| 1051 | expect (home.exists()); |
| 1052 | expect (! home.existsAsFile()); |
| 1053 | expect (File::getSpecialLocation (File::userApplicationDataDirectory).isDirectory()); |
| 1054 | expect (File::getSpecialLocation (File::currentExecutableFile).exists()); |
| 1055 | expect (File::getSpecialLocation (File::currentApplicationFile).exists()); |
| 1056 | expect (File::getSpecialLocation (File::invokedExecutableFile).exists()); |
| 1057 | expect (home.getVolumeTotalSize() > 1024 * 1024); |
| 1058 | expect (home.getBytesFreeOnVolume() > 0); |
| 1059 | expect (! home.isHidden()); |
| 1060 | expect (home.isOnHardDisk()); |
| 1061 | expect (! home.isOnCDRomDrive()); |
| 1062 | expect (File::getCurrentWorkingDirectory().exists()); |
| 1063 | expect (home.setAsCurrentWorkingDirectory()); |
| 1064 | expect (File::getCurrentWorkingDirectory() == home); |
| 1065 | |
| 1066 | { |
| 1067 | Array<File> roots; |
| 1068 | File::findFileSystemRoots (roots); |
| 1069 | expect (roots.size() > 0); |
| 1070 | |
| 1071 | int numRootsExisting = 0; |
| 1072 | for (int i = 0; i < roots.size(); ++i) |
| 1073 | if (roots[i].exists()) |
| 1074 | ++numRootsExisting; |
| 1075 | |
| 1076 | // (on windows, some of the drives may not contain media, so as long as at least one is ok..) |
| 1077 | expect (numRootsExisting > 0); |
| 1078 | } |
| 1079 | |
| 1080 | beginTest ("Writing"); |
| 1081 | |
| 1082 | File demoFolder (temp.getChildFile ("JUCE UnitTests Temp Folder.folder")); |
| 1083 | expect (demoFolder.deleteRecursively()); |
| 1084 | expect (demoFolder.createDirectory()); |
| 1085 | expect (demoFolder.isDirectory()); |
| 1086 | expect (demoFolder.getParentDirectory() == temp); |
| 1087 | expect (temp.isDirectory()); |
| 1088 | expect (temp.findChildFiles (File::findFilesAndDirectories, false, "*").contains (demoFolder)); |
| 1089 | expect (temp.findChildFiles (File::findDirectories, true, "*.folder").contains (demoFolder)); |
| 1090 | |
| 1091 | File tempFile (demoFolder.getNonexistentChildFile ("test", ".txt", false)); |
| 1092 | |
| 1093 | expect (tempFile.getFileExtension() == ".txt"); |
| 1094 | expect (tempFile.hasFileExtension (".txt")); |
nothing calls this directly
no test coverage detected