WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
91983
[EFL][WK2] Add unit tests for custom text encoding setting
https://bugs.webkit.org/show_bug.cgi?id=91983
Summary
[EFL][WK2] Add unit tests for custom text encoding setting
Sudarsana Nagineni (babu)
Reported
2012-07-23 04:50:14 PDT
Add unit tests for custom text encoding setting.
Attachments
Patch
(2.43 KB, patch)
2012-07-23 05:24 PDT
,
Sudarsana Nagineni (babu)
no flags
Details
Formatted Diff
Diff
Patch
(2.38 KB, patch)
2012-07-23 13:22 PDT
,
Sudarsana Nagineni (babu)
no flags
Details
Formatted Diff
Diff
Patch
(2.40 KB, patch)
2012-07-23 15:17 PDT
,
Sudarsana Nagineni (babu)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Sudarsana Nagineni (babu)
Comment 1
2012-07-23 05:24:25 PDT
Created
attachment 153781
[details]
Patch
Sudarsana Nagineni (babu)
Comment 2
2012-07-23 13:22:17 PDT
Created
attachment 153850
[details]
Patch Add unit tests for set/get custom text encoding.
Chris Dumez
Comment 3
2012-07-23 13:26:22 PDT
Comment on
attachment 153850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=153850&action=review
> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:39 > + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), 0);
Should we really use ASSERT_STREQ() for 0? Why not use ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); ?
> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:40 > + ewk_view_setting_encoding_custom_set(webView(), "UTF-8");
Would be nice to test the return value.
> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:43 > + ewk_view_setting_encoding_custom_set(webView(), 0);
Ditto.
> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:44 > + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), 0);
Should we really use ASSERT_STREQ() for 0? Why not use ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); ?
Sudarsana Nagineni (babu)
Comment 4
2012-07-23 14:02:07 PDT
Comment on
attachment 153850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=153850&action=review
>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:39 >> + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), 0); > > Should we really use ASSERT_STREQ() for 0? Why not use ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); ?
ASSERT_FALSE also works in this case, but is there anything wrong in using ASSERT_STREQ() here? *_get() returns a C string and I want to assert if C string is NULL(like explained in docs ASSERT_STREQ(NULL, c_string)). But, style checker pushed me to use 0 instead of NULL.
>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:40 >> + ewk_view_setting_encoding_custom_set(webView(), "UTF-8"); > > Would be nice to test the return value.
I wonder how much it makes sense to test the return value of set function, because it returns always true(except in case of invalid input arg). That's the reason I am calling get immediately after set and comparing the C string.
Chris Dumez
Comment 5
2012-07-23 14:14:08 PDT
Comment on
attachment 153850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=153850&action=review
>>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:39 >>> + ASSERT_STREQ(ewk_view_setting_encoding_custom_get(webView()), 0); >> >> Should we really use ASSERT_STREQ() for 0? Why not use ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView())); ? > > ASSERT_FALSE also works in this case, but is there anything wrong in using ASSERT_STREQ() here? *_get() returns a C string and I want to assert if C string is NULL(like explained in docs ASSERT_STREQ(NULL, c_string)). But, style checker pushed me to use 0 instead of NULL.
I don't know if it's wrong but at least it is confusing.
>>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:40 >>> + ewk_view_setting_encoding_custom_set(webView(), "UTF-8"); >> >> Would be nice to test the return value. > > I wonder how much it makes sense to test the return value of set function, because it returns always true(except in case of invalid input arg). That's the reason I am calling get immediately after set and comparing the C string.
Well, better safe than sorry. Just because the current implementation always returns TRUE, does not mean the code will stay this way. It is always a good idea to test as much as possible. In this case, it is very easy to add an ASSERT_TRUE() and make sure the return value is really true (and stays that way in the future).
Sudarsana Nagineni (babu)
Comment 6
2012-07-23 14:31:35 PDT
Comment on
attachment 153850
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=153850&action=review
>>>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:40 >>>> + ewk_view_setting_encoding_custom_set(webView(), "UTF-8"); >>> >>> Would be nice to test the return value. >> >> I wonder how much it makes sense to test the return value of set function, because it returns always true(except in case of invalid input arg). That's the reason I am calling get immediately after set and comparing the C string. > > Well, better safe than sorry. Just because the current implementation always returns TRUE, does not mean the code will stay this way. It is always a good idea to test as much as possible. In this case, it is very easy to add an ASSERT_TRUE() and make sure the return value is really true (and stays that way in the future).
Yes, it is easy to add and I don't mind adding, but I'm just trying to understand the real use of it with the current implementation. Isn't it true that we should update the test code when we change the APIs implementation?
Sudarsana Nagineni (babu)
Comment 7
2012-07-23 15:17:18 PDT
Created
attachment 153874
[details]
Patch Fix review
comment #3
.
Gyuyoung Kim
Comment 8
2012-07-23 18:55:35 PDT
Comment on
attachment 153874
[details]
Patch LGTM.
WebKit Review Bot
Comment 9
2012-07-24 15:54:23 PDT
Comment on
attachment 153874
[details]
Patch Clearing flags on attachment: 153874 Committed
r123545
: <
http://trac.webkit.org/changeset/123545
>
WebKit Review Bot
Comment 10
2012-07-24 15:54:28 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug