Fix invalid licenses
[platform/framework/web/crosswalk-tizen.git] / tests / popup / test_popup.cc
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #include <Elementary.h>
19 #include <string>
20 #include <iostream>
21 #include "popup/popup.h"
22 #include "popup/popup_string.h"
23
24 int main(int argc, char **argv) {
25   const char* kLocaleKorean = "ko_KR";
26   setlocale(LC_ALL, kLocaleKorean);
27   bindtextdomain("wrt", "/usr/share/locale");
28
29   Evas_Object* win;
30
31   elm_init(argc, argv);
32   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
33
34   win = elm_win_util_standard_add("sample", "Sample");
35   elm_win_autodel_set(win, EINA_TRUE);
36
37   const std::string title = wrt::popup_string::kPopupTitleCert;
38   const std::string body_text =
39     wrt::popup_string::GetText(wrt::popup_string::kPopupBodyCert) +
40     "<br>" + "http://url.url";
41   const std::string check_label =
42     wrt::popup_string::kPopupCheckRememberPreference;
43   const std::string entry_1_label = wrt::popup_string::kPopupLabelAuthusername;
44   const std::string entry_2_label = wrt::popup_string::kPopupLabelPassword;
45
46   wrt::Popup* popup = wrt::Popup::CreatePopup(win);
47   popup->SetTitle(title);
48   popup->SetBody(body_text);
49   popup->SetFirstEntry(entry_1_label, wrt::Popup::EntryType::Edit);
50   popup->SetSecondEntry(entry_2_label, wrt::Popup::EntryType::PwEdit);
51   popup->SetCheckBox(check_label);
52   popup->SetButtonType(wrt::Popup::ButtonType::AllowDenyButton);
53   popup-> SetResultHandler([](wrt::Popup* popup, void* user_data) {
54     std::cout<< popup->GetFirstEntryResult() << std::endl;
55     std::cout<< popup->GetSecondEntryResult() << std::endl;
56     std::cout<< popup->GetCheckBoxResult() << std::endl;
57     std::cout<< popup->GetButtonResult() << std::endl;
58   }, NULL);
59   popup->Show();
60
61   elm_language_set(kLocaleKorean);
62
63   evas_object_resize(win, 200, 100);
64   evas_object_show(win);
65
66   elm_run();
67   elm_shutdown();
68
69   return 0;
70 }