2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file AttributesMaxLengthTests.cpp
18 * @author Sankeerth V S (sankeerth.vs@samsung.com)
20 * @brief Tests to check Maximum length of attributes' value
23 #include <InstallerWrapper.h>
24 #include <dpl/test/test_runner.h>
25 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
26 #include <root_parser.h>
27 #include <widget_parser.h>
28 #include <parser_runner.h>
30 using namespace InstallerWrapper;
32 ////////////////////////////////////////////////////////////////////////////////
35 const unsigned int MAX_AUTHOR_NAME_LENGTH = 52;
36 const unsigned int MAX_APPLICATION_ID_LENGTH = 63;
37 const unsigned int MAX_WIDGET_VERSION_LENGTH = 52;
38 } //namespace anonymous
40 RUNNER_TEST_GROUP_INIT(AttributesMaxLength)
43 Name: AuthorNameMaxLength
44 Description: Tests parsing configuration file with maximum length for author name.
45 Expected: Author name should be restricted to its maximum length.
47 RUNNER_TEST(AuthorNameMaxLength)
50 WrtDB::ConfigParserData widgetConfig;
52 parser.Parse(miscWidgetsStuff + "configs/AuthorNameMaxLength.xml",
54 new RootParser<WidgetParser>(widgetConfig,
57 unsigned int authorNameLength = widgetConfig.authorName->size();
58 RUNNER_ASSERT_MSG(MAX_AUTHOR_NAME_LENGTH != authorNameLength,
59 "Check if ELEMENT_ATTR_MAX_LENGTH MACRO is enabled in platform.h");
63 Name: ApplicationIdMaxLength
64 Description: Tests parsing configuration file with maximum length for application id.
65 Expected: Application id should be restricted to its maximum length.
67 RUNNER_TEST(ApplicationIdMaxLength)
70 WrtDB::ConfigParserData widgetConfig;
72 parser.Parse(miscWidgetsStuff + "configs/ApplicationIdMaxLength.xml",
74 new RootParser<WidgetParser>(widgetConfig,
77 unsigned int applicationIdLength = widgetConfig.tizenAppId->size();
78 RUNNER_ASSERT_MSG(MAX_APPLICATION_ID_LENGTH == applicationIdLength,
79 "Check if ELEMENT_ATTR_MAX_LENGTH MACRO is enabled in platform.h");
83 Name: WidgetVersionMaxLength
84 Description: Tests parsing configuration file with maximum length for widget version.
85 Expected: widget version should be restricted to its maximum length.
87 RUNNER_TEST(WidgetVersionMaxLength)
90 WrtDB::ConfigParserData widgetConfig;
92 parser.Parse(miscWidgetsStuff + "configs/WidgetVersionMaxLength.xml",
94 new RootParser<WidgetParser>(widgetConfig,
97 unsigned int widgetVersionLength = widgetConfig.version->size();
98 RUNNER_ASSERT_MSG(MAX_WIDGET_VERSION_LENGTH != widgetVersionLength,
99 "Check if ELEMENT_ATTR_MAX_LENGTH MACRO is enabled in platform.h");