Skip to content

Commit

Permalink
More tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kunitoki committed Dec 3, 2024
1 parent d3a73e3 commit 5bfb150
Showing 1 changed file with 28 additions and 36 deletions.
64 changes: 28 additions & 36 deletions tests/juce_core/juce_ZipFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ZipFileTests : public ::testing::Test
}
};

TEST_F (ZipFileTests, DISABLED_BasicZipFileFunctionality)
TEST_F (ZipFileTests, BasicZipFileFunctionality)
{
StringArray entryNames { "first", "second", "third" };
auto data = createZipMemoryBlock (entryNames);
Expand Down Expand Up @@ -146,29 +146,25 @@ TEST_F (ZipFileTests, CreateFromFile)
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.getNumEntries(), 0); // Assumes the test.zip is empty or non-existent
EXPECT_EQ (zip.getNumEntries(), 0);
}

TEST_F (ZipFileTests, CreateFromInputStream)
TEST_F (ZipFileTests, DISABLED_CreateFromInputStream)
{
/*
File zipFile = getNonExistingZipFile();
FileInputStream fileStream(zipFile);
ZipFile zip(&fileStream, false);
FileInputStream fileStream (zipFile);
ZipFile zip (&fileStream, false);

EXPECT_EQ(zip.getNumEntries(), 0); // Assumes the test.zip is empty or non-existent
*/
EXPECT_EQ (zip.getNumEntries(), 0);
}

TEST_F (ZipFileTests, CreateFromInputStreamNoOwnership)
TEST_F (ZipFileTests, DISABLED_CreateFromInputStreamNoOwnership)
{
/*
File zipFile = getNonExistingZipFile();
FileInputStream fileStream(zipFile);
ZipFile zip(fileStream);
FileInputStream fileStream (zipFile);
ZipFile zip (fileStream);

EXPECT_EQ(zip.getNumEntries(), 0); // Assumes the test.zip is empty or non-existent
*/
EXPECT_EQ (zip.getNumEntries(), 0);
}

TEST_F (ZipFileTests, CreateFromInputSource)
Expand All @@ -186,39 +182,39 @@ TEST_F (ZipFileTests, CreateFromInputSource)
auto* inputSource = new TestInputSource;
ZipFile zip (inputSource);

EXPECT_EQ (zip.getNumEntries(), 0); // Assumes the TestInputSource returns null streams
EXPECT_EQ (zip.getNumEntries(), 0);
}

TEST_F (ZipFileTests, GetNumEntries)
{
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.getNumEntries(), 0); // Assumes the test.zip is empty or non-existent
EXPECT_EQ (zip.getNumEntries(), 0);
}

TEST_F (ZipFileTests, GetEntryByIndex)
{
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.getEntry (0), nullptr); // Assumes the test.zip is empty or non-existent
EXPECT_EQ (zip.getEntry (0), nullptr);
}

TEST_F (ZipFileTests, GetEntryByName)
{
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.getEntry ("nonexistent.txt"), nullptr); // Assumes the test.zip does not contain this file
EXPECT_EQ (zip.getEntry ("nonexistent.txt"), nullptr);
}

TEST_F (ZipFileTests, GetIndexOfFileName)
{
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.getIndexOfFileName ("nonexistent.txt"), -1); // Assumes the test.zip does not contain this file
EXPECT_EQ (zip.getIndexOfFileName ("nonexistent.txt"), -1);
}

TEST_F (ZipFileTests, SortEntriesByFilename)
Expand All @@ -235,7 +231,7 @@ TEST_F (ZipFileTests, CreateStreamForEntryByIndex)
File zipFile = getNonExistingZipFile();
ZipFile zip (zipFile);

EXPECT_EQ (zip.createStreamForEntry (0), nullptr); // Assumes the test.zip is empty or non-existent
EXPECT_EQ (zip.createStreamForEntry (0), nullptr);
}

TEST_F (ZipFileTests, CreateStreamForEntryByName)
Expand All @@ -244,31 +240,27 @@ TEST_F (ZipFileTests, CreateStreamForEntryByName)
ZipFile zip (zipFile);

const ZipFile::ZipEntry* entry = zip.getEntry ("nonexistent.txt");
ASSERT_EQ (nullptr, entry);
EXPECT_EQ (nullptr, entry);
}

TEST_F (ZipFileTests, UncompressTo)
TEST_F (ZipFileTests, DISABLED_UncompressTo)
{
/*
File zipFile = getNonExistingZipFile();
ZipFile zip(zipFile);
File targetDirectory(File::getCurrentWorkingDirectory().getChildFile("unzip_test"));
ZipFile zip (zipFile);
File targetDirectory (File::getCurrentWorkingDirectory().getChildFile ("unzip_test"));

Result result = zip.uncompressTo(targetDirectory, true);
EXPECT_FALSE(result.wasOk()); // Assumes the test.zip is empty or non-existent
*/
Result result = zip.uncompressTo (targetDirectory, true);
EXPECT_FALSE (result.wasOk());
}

TEST_F (ZipFileTests, UncompressEntry)
TEST_F (ZipFileTests, DISABLED_UncompressEntry)
{
/*
File zipFile = getNonExistingZipFile();
ZipFile zip(zipFile);
File targetDirectory(File::getCurrentWorkingDirectory().getChildFile("unzip_test"));
ZipFile zip (zipFile);
File targetDirectory (File::getCurrentWorkingDirectory().getChildFile ("unzip_test"));

Result result = zip.uncompressEntry(0, targetDirectory, true);
EXPECT_FALSE(result.wasOk()); // Assumes the test.zip is empty or non-existent
*/
Result result = zip.uncompressEntry (0, targetDirectory, true);
EXPECT_FALSE (result.wasOk());
}

TEST_F (ZipFileTests, BuilderAddFile)
Expand All @@ -293,5 +285,5 @@ TEST_F (ZipFileTests, BuilderWriteToStream)
MemoryOutputStream outputStream;

bool result = builder.writeToStream (outputStream, nullptr);
EXPECT_TRUE (result); // Expecting true even if the builder is empty
EXPECT_TRUE (result);
}

0 comments on commit 5bfb150

Please sign in to comment.