diff --git a/test/source/scwx/qt/util/network.test.cpp b/test/source/scwx/qt/util/network.test.cpp index 8a240ffe..21524d0c 100644 --- a/test/source/scwx/qt/util/network.test.cpp +++ b/test/source/scwx/qt/util/network.test.cpp @@ -12,13 +12,49 @@ namespace util { const std::vector> testUrls = { - {" https://example.com/ ", "https://example.com/"}, - {"\thttps://example.com/\t", "https://example.com/"}, - {"\nhttps://example.com/\n", "https://example.com/"}, - {"\rhttps://example.com/\r", "https://example.com/"}, - {"\r\nhttps://example.com/\r\n", "https://example.com/"}, - {" https://example.com/ ", "https://example.com/"}, - {" \nhttps://example.com/ \n ", "https://example.com/"}, + {" https://example.com/path/to+a+test/file.txt ", + "https://example.com/path/to+a+test/file.txt"}, + {"\thttps://example.com/path/to+a+test/file.txt\t", + "https://example.com/path/to+a+test/file.txt"}, + {"\nhttps://example.com/path/to+a+test/file.txt\n", + "https://example.com/path/to+a+test/file.txt"}, + {"\rhttps://example.com/path/to+a+test/file.txt\r", + "https://example.com/path/to+a+test/file.txt"}, + {"\r\nhttps://example.com/path/to+a+test/file.txt\r\n", + "https://example.com/path/to+a+test/file.txt"}, + {" https://example.com/path/to+a+test/file.txt ", + "https://example.com/path/to+a+test/file.txt"}, + {" \nhttps://example.com/path/to+a+test/file.txt \n ", + "https://example.com/path/to+a+test/file.txt"}, + + // Only tested for this OS because NormalizeUrl uses native separators +#ifdef _WIN32 + {" C:\\path\\to a test\\file.txt ", "C:\\path\\to a test\\file.txt"}, + {"\tC:\\path\\to a test\\file.txt\t", "C:\\path\\to a test\\file.txt"}, + {"\nC:\\path\\to a test\\file.txt\n", "C:\\path\\to a test\\file.txt"}, + {"\rC:\\path\\to a test\\file.txt\r", "C:\\path\\to a test\\file.txt"}, + {"\r\nC:\\path\\to a test\\file.txt\r\n", "C:\\path\\to a test\\file.txt"}, + {" C:\\path\\to a test\\file.txt ", "C:\\path\\to a test\\file.txt"}, + {" \nC:\\path\\to a test\\file.txt \n ", + "C:\\path\\to a test\\file.txt"}, + + {" C:/path/to a test/file.txt ", "C:\\path\\to a test\\file.txt"}, + {"\tC:/path/to a test/file.txt\t", "C:\\path\\to a test\\file.txt"}, + {"\nC:/path/to a test/file.txt\n", "C:\\path\\to a test\\file.txt"}, + {"\rC:/path/to a test/file.txt\r", "C:\\path\\to a test\\file.txt"}, + {"\r\nC:/path/to a test/file.txt\r\n", "C:\\path\\to a test\\file.txt"}, + {" C:/path/to a test/file.txt ", "C:\\path\\to a test\\file.txt"}, + {" \nC:/path/to a test/file.txt \n ", "C:\\path\\to a test\\file.txt"}, +#else + + {" /path/to a test/file.txt ", "/path/to a test/file.txt"}, + {"\t/path/to a test/file.txt\t", "/path/to a test/file.txt"}, + {"\n/path/to a test/file.txt\n", "/path/to a test/file.txt"}, + {"\r/path/to a test/file.txt\r", "/path/to a test/file.txt"}, + {"\r\n/path/to a test/file.txt\r\n", "/path/to a test/file.txt"}, + {" /path/to a test/file.txt ", "/path/to a test/file.txt"}, + {" \n/path/to a test/file.txt \n ", "/path/to a test/file.txt"}, +#endif }; TEST(network, NormalizeUrl)