winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

IconExtraction.cpp (657B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #include "pch.h"
      4 #include "TestCommon.h"
      5 #include <winget/IconExtraction.h>
      6 #include <AppInstallerStrings.h>
      7 
      8 using namespace AppInstaller::Repository;
      9 
     10 TEST_CASE("ExtractIconFromBinaryFile", "IconExtraction")
     11 {
     12     auto extracted = ExtractIconFromBinaryFile(TestCommon::TestDataFile{ "notepad.exe" }.GetPath());
     13 
     14     std::ifstream expectedIconFile{ TestCommon::TestDataFile{ "notepad.ico" }.GetPath(), std::ios::in | std::ios::binary};
     15     auto expected = AppInstaller::Utility::ReadEntireStreamAsByteArray(expectedIconFile);
     16 
     17     REQUIRE(expected == extracted);
     18 }