And also, make default KeyEvent::New() API, for coverage.
Change-Id: Id8fbaea475664db81609a78116c091d15d813713
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const static int SHIFT_AND_ALT_MODIFIER = SHIFT_MODIFIER | ALT_MODIFIER;
const static int CTRL_AND_ALT_MODIFIER = CTRL_MODIFIER | ALT_MODIFIER;
+const static int32_t KEY_INVALID_CODE = -1;
+
const static char* TEST_STRING_1 = "alpha";
// Stores data that is populated in the callback and will be read by the TET cases
} // namespace
+int UtcDaliKeyEventDefaultConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Dali::KeyEvent event = DevelKeyEvent::New();
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS("", event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(KEY_INVALID_CODE, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(0, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
+ DALI_TEST_EQUALS(false, event.IsRepeat(), TEST_LOCATION); // check repeat
+
+ END_TEST;
+}
+
int UtcDaliKeyEventConstructor(void)
{
TestApplication application; // Reset all test adapter return codes
/*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
{\r
namespace DevelKeyEvent\r
{\r
+KeyEvent New()\r
+{\r
+ Internal::KeyEventPtr internal = Internal::KeyEvent::New();\r
+\r
+ return KeyEvent(internal.Get());\r
+}\r
+\r
KeyEvent New(const std::string& keyName,\r
const std::string& logicalKey,\r
const std::string& keyString,\r
#define DALI_KEY_EVENT_DEVEL_H\r
\r
/*\r
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
namespace DevelKeyEvent\r
{\r
/**\r
+ * @brief Creates an initialized KeyEvent as default.\r
+ *\r
+ * @SINCE_2_2.45\r
+ * @return A handle to a newly allocated Dali resource\r
+ */\r
+DALI_CORE_API KeyEvent New();\r
+\r
+/**\r
* @brief Creates an initialized KeyEvent.\r
*\r
* @SINCE_1_9.27\r
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mCompose(""),
mDeviceName(""),
mDeviceClass(Device::Class::NONE),
- mDeviceSubclass(Device::Subclass::NONE)
+ mDeviceSubclass(Device::Subclass::NONE),
+ mIsRepeat(false)
{
}
{
}
+KeyEventPtr KeyEvent::New()
+{
+ KeyEventPtr keyEvent = new KeyEvent();
+ return keyEvent;
+}
+
KeyEventPtr KeyEvent::New(const std::string& keyName,
const std::string& logicalKey,
const std::string& keyString,
#define DALI_INTERNAL_KEY_EVENT_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const Device::Subclass::Type deviceSubclass);
/**
+ * Create a new default KeyEvent.
+ * @return A smart-pointer to the newly allocated KeyEvent.
+ */
+ static KeyEventPtr New();
+
+ /**
* Create a new KeyEvent.
*
* @param[in] keyName The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.