blob: 0c13f87149f46d7947e75311fb83a17619dfc302 [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/platform/windows/testing/wm_builders.h"
namespace flutter {
namespace testing {
Win32Message WmKeyDownInfo::Build(LRESULT expected_result, HWND hWnd) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(prev_state << 30);
return Win32Message{
.message = WM_KEYDOWN,
.wParam = key,
.lParam = lParam,
.expected_result = expected_result,
.hWnd = hWnd,
};
}
Win32Message WmKeyUpInfo::Build(LRESULT expected_result, HWND hWnd) {
uint32_t lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (1 /* prev_state */ << 30) |
(1 /* transition */ << 31);
return Win32Message{
.message = WM_KEYUP,
.wParam = key,
.lParam = lParam,
.expected_result = expected_result,
.hWnd = hWnd,
};
}
Win32Message WmCharInfo::Build(LRESULT expected_result, HWND hWnd) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 30) | (prev_state << 30) | (transition << 31);
return Win32Message{
.message = WM_CHAR,
.wParam = char_code,
.lParam = lParam,
.expected_result = expected_result,
.hWnd = hWnd,
};
}
Win32Message WmSysKeyUpInfo::Build(LRESULT expected_result, HWND hWnd) {
uint32_t lParam = (1 /* repeat_count */ << 0) | (scan_code << 16) |
(extended << 24) | (context << 29) |
(1 /* prev_state */ << 30) | (1 /* transition */ << 31);
return Win32Message{
.message = WM_SYSKEYUP,
.wParam = key,
.lParam = lParam,
.expected_result = expected_result,
.hWnd = hWnd,
};
}
Win32Message WmDeadCharInfo::Build(LRESULT expected_result, HWND hWnd) {
uint32_t lParam = (repeat_count << 0) | (scan_code << 16) | (extended << 24) |
(context << 30) | (prev_state << 30) | (transition << 31);
return Win32Message{
.message = WM_DEADCHAR,
.wParam = char_code,
.lParam = lParam,
.expected_result = expected_result,
.hWnd = hWnd,
};
}
} // namespace testing
} // namespace flutter