mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
* Move retrieveing file attibutes to PowerRenameRegex Move file attributes unit tests to PowerRenameRegexTests Add file time field to MockPowerRenameItem * Add file attributes unittests to PowerRenameManagerTests * Change variable name * Rearrange function arguments * Check if file attributes are used only once * Change variable name LocalTime -> fileTime, date -> time * Set fileTime as a member of PowerRenameRegEx rather than passing as an argument * Change function name isFileAttributesUsed() -> isFileTimeUsed() Check before resetting fileTime * Fix small bugs * Fix typos * Refactor for readability, move free calls to reachable places * Fix search for area empty bug searchTerm being empty is not an invalid argument rather it must return OK without any operation Tests must check if Replace() returns S_OK becuase later it checks its result * Check return values of method calls in PowerRenameManager Remove received argments checks from some methods because argument being null or empty string doesnt mean it is invalid or method fails * Fix formatting. Remove overlooked comment. Fix error message. * Change HRESULT declarations according to coding style * Fix unhandled case. Refactor.
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#pragma once
|
|
#include <vector>
|
|
#include "srwlock.h"
|
|
|
|
#include "PowerRenameInterfaces.h"
|
|
class CMockPowerRenameRegExEvents :
|
|
public IPowerRenameRegExEvents
|
|
{
|
|
public:
|
|
// IUnknown
|
|
IFACEMETHODIMP QueryInterface(_In_ REFIID iid, _Outptr_ void** resultInterface);
|
|
IFACEMETHODIMP_(ULONG)
|
|
AddRef();
|
|
IFACEMETHODIMP_(ULONG)
|
|
Release();
|
|
|
|
// IPowerRenameRegExEvents
|
|
IFACEMETHODIMP OnSearchTermChanged(_In_ PCWSTR searchTerm);
|
|
IFACEMETHODIMP OnReplaceTermChanged(_In_ PCWSTR replaceTerm);
|
|
IFACEMETHODIMP OnFlagsChanged(_In_ DWORD flags);
|
|
IFACEMETHODIMP OnFileTimeChanged(_In_ SYSTEMTIME fileTime);
|
|
|
|
static HRESULT s_CreateInstance(_Outptr_ IPowerRenameRegExEvents** ppsrree);
|
|
|
|
CMockPowerRenameRegExEvents() :
|
|
m_refCount(1)
|
|
{
|
|
}
|
|
|
|
~CMockPowerRenameRegExEvents()
|
|
{
|
|
CoTaskMemFree(m_searchTerm);
|
|
CoTaskMemFree(m_replaceTerm);
|
|
}
|
|
|
|
PWSTR m_searchTerm = nullptr;
|
|
PWSTR m_replaceTerm = nullptr;
|
|
DWORD m_flags = 0;
|
|
SYSTEMTIME m_fileTime = { 0 };
|
|
long m_refCount;
|
|
};
|