diff options
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/files/strip_tags1.html | 58 | ||||
| -rw-r--r-- | tests/utils_tests/files/strip_tags2.txt | 26 | ||||
| -rw-r--r-- | tests/utils_tests/test_module/bad_module.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_module/good_module.py | 2 |
4 files changed, 44 insertions, 44 deletions
diff --git a/tests/utils_tests/files/strip_tags1.html b/tests/utils_tests/files/strip_tags1.html index 8e9ee1d8fd..5e191f31fd 100644 --- a/tests/utils_tests/files/strip_tags1.html +++ b/tests/utils_tests/files/strip_tags1.html @@ -13,7 +13,7 @@ <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" /> <meta name="msapplication-TileImage" content="/windows-tile.png"> <meta name="msapplication-TileColor" content="#ffffff"> - + <link rel="icon" type="image/x-icon" href="/favicon.ico" /> <meta content="authenticity_token" name="csrf-param" /> @@ -21,12 +21,12 @@ <link href="https://a248.e.akamai.net/assets.github.com/assets/github-f70e4783e00fd4884a9e5e651a43933c9881caa8.css" media="all" rel="stylesheet" type="text/css" /> <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-0d31290d073dea4d8671e2b8c747629aeb074034.css" media="all" rel="stylesheet" type="text/css" /> - + <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-d76b58e749b52bc47a4c46620bf2c320fabe5248.js" type="text/javascript"></script> <script src="https://a248.e.akamai.net/assets.github.com/assets/github-67b55380cff8d6766b298e6935a3c1db7d5c6d5d.js" type="text/javascript"></script> - + <meta http-equiv="x-pjax-version" content="1212ad79754350a805cefbcd08a3dadf"> <link data-pjax-transient rel='alternate' type='text/plain+diff' href="/django/django/commit/d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e.diff"> @@ -89,9 +89,9 @@ </ul> </div> - - + + <ul id="user-links"> <li> <a href="https://github.com/claudep" class="name"> @@ -119,17 +119,17 @@ - + </div> </div> <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage"> <div class="hentry"> - + <div class="pagehead repohead instapaper_ignore readability-menu "> <div class="container"> <div class="title-actions-bar"> - + <ul class="pagehead-actions"> @@ -240,7 +240,7 @@ </h1> </div> - + <ul class="tabs"> <li><a href="/django/django" class="selected" highlight="repo_source repo_downloads repo_commits repo_tags repo_branches">Code</a></li> <li><a href="/django/django/network" highlight="repo_network">Network</a></li> @@ -256,14 +256,14 @@ </li> </ul> - + <div class="tabnav"> <span class="tabnav-right"> <ul class="tabnav-tabs"> <li><a href="/django/django/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter ">39</span></a></li> </ul> - + </span> <div class="tabnav-widget scope"> @@ -648,17 +648,17 @@ </div> - - - - + + + + </div> </div><!-- /.repohead --> <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container> - + <div class="commit full-commit "> @@ -675,7 +675,7 @@ <span class="sha-block" data-pjax> 1 parent - + <a href="/django/django/commit/afa3e1633431137f4e76c7efc359b579f4d9c08e" class="sha" data-hotkey="p">afa3e16</a> </span> @@ -689,7 +689,7 @@ </div> <a name="diff-stat"></a> - + <div id='toc' class="details-collapse js-details-container "> <p class="explain"> <span class="mini-icon mini-icon-diff"></span>Showing <strong>2 changed files</strong> @@ -720,7 +720,7 @@ </ol> </div> - + <div id="files" class="diff-view commentable"> <div id="diff-0" class="file js-details-container"> <div class="meta" data-path="django/utils/html.py"> @@ -730,7 +730,7 @@ <span class="js-selectable-text css-truncate css-truncate-target" title="django/utils/html.py"> django/utils/html.py </span> - + </div> <div class="actions"> <span class="show-inline-notes"> @@ -868,7 +868,7 @@ <span class="js-selectable-text css-truncate css-truncate-target" title="tests/regressiontests/utils/html.py"> tests/regressiontests/utils/html.py </span> - + </div> <div class="actions"> <span class="show-inline-notes"> @@ -1007,7 +1007,7 @@ <div class="discussion-bubble-content bubble"> <div class="discussion-bubble-inner"> <input type='hidden' name='commit_id' value='d7504a3d7b8645bdb979bab7ded0e9a9b6dccd0e'> - + <div class="js-previewable-comment-form previewable-comment-form write-selected" data-preview-url="/preview?repository=4164482"> <div class="comment-form-head tabnav"> @@ -1022,7 +1022,7 @@ <div class="comment-form-error js-comment-form-error" style="display:none;"></div> <div id="write_bucket_525" class="write-content js-write-bucket js-uploadable-container upload-enabled is-default" data-model="asset"> - + <a href="#fullscreen_comment_body_525" class="enable-fullscreen js-enable-fullscreen tooltipped leftwards " title="Zen Mode"> <span class="mini-icon mini-icon-fullscreen"></span> @@ -1036,7 +1036,7 @@ data-suggester="525_new_preview_suggester" required></textarea> - + <p class="drag-and-drop"> <span class="default"> Attach images by dragging & dropping them or @@ -1059,7 +1059,7 @@ </div> <div id="preview_bucket_525" class="preview-content js-preview-bucket"> - + <div id="openstruct-163168300" class="js-comment comment"> <div class="comment-header normal-comment-header"> <img class="comment-header-gravatar" height="22" src="https://secure.gravatar.com/avatar/cf4198670f0073174b475634964b576b?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="22" /> @@ -1110,7 +1110,7 @@ </div> - + <div class="thread-subscription-status clearfix"> <span class="mega-icon mega-icon-notifications"></span> @@ -1293,10 +1293,10 @@ <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a> </div> - - + + <span id='server_response_time' data-time='0.09780' data-host='fe2'></span> - + </body> </html> diff --git a/tests/utils_tests/files/strip_tags2.txt b/tests/utils_tests/files/strip_tags2.txt index 6b2a4033c2..331af904ea 100644 --- a/tests/utils_tests/files/strip_tags2.txt +++ b/tests/utils_tests/files/strip_tags2.txt @@ -4,31 +4,31 @@ _The code example is available on [github](http://github.com/iontech/Fragments_E _____________________________________________________________ Ever wanted a code snippet from an Activity to be available to other activities? Perhaps a Button or a ListView, maybe a Layout or any View/ViewGroup for that matter? Fragments let us do just that. -Necessity is the mother of invention. +Necessity is the mother of invention. Before understanding what Fragments are and how they work, we must first realize their existence in the first place. The Problem ----------- -Suppose we have an Android app with two Activities- [*FirstActivity*](https://github.com/iontech/Fragments_Example/blob/master/src/main/java/com/github/iontech/fragments_example/FirstActivity.java) and [*SecondActivity*](https://github.com/iontech/Fragments_Example/blob/master/src/main/java/com/github/iontech/fragments_example/SecondActivity.java). -*FirstActivity* contains two Views, a `TextView` (*textView*) and a `Button` (*button1*); and *button1* has an `onClick()` callback that `Toast`'s a simple message "Button pressed". +Suppose we have an Android app with two Activities- [*FirstActivity*](https://github.com/iontech/Fragments_Example/blob/master/src/main/java/com/github/iontech/fragments_example/FirstActivity.java) and [*SecondActivity*](https://github.com/iontech/Fragments_Example/blob/master/src/main/java/com/github/iontech/fragments_example/SecondActivity.java). +*FirstActivity* contains two Views, a `TextView` (*textView*) and a `Button` (*button1*); and *button1* has an `onClick()` callback that `Toast`'s a simple message "Button pressed". *SecondActivity* contains both the Views present in *FirstActivity* and a `Button` (*button2*). Now we want to utilize the two layout components(Views) of *FirstActivity* in *SecondActivity*, we can go about this with two approaches: 1. Copy and Paste the xml elements of the two Views. -2. Create a separate layout for common Views and reuse it using `` layout element. +2. Create a separate layout for common Views and reuse it using `` layout element. More about this [here](http://developer.android.com/training/improving-layouts/reusing-layouts.html). Electing the second approach makes sense cause it enables us to make reusable layouts. Everything seems great till now. We are able to make reusable layouts and use them as many times as we want. -Now recollect that we have an `onClick()` callback assigned to *button1*. How do we reuse the same callback functionality of *button1* across multiple Activities? `` lets us reuse layouts and not the Activity source. +Now recollect that we have an `onClick()` callback assigned to *button1*. How do we reuse the same callback functionality of *button1* across multiple Activities? `` lets us reuse layouts and not the Activity source. This is where Fragments come into play. Fragments --------- <center>  </center> Fragments encompass both layout resource and Java source. Hence, unlike ``, they allow us to reuse the View components along with their functionality, if needed. -Fragments were first introduced in Honeycomb(API 11), living under the `android.app` package. +Fragments were first introduced in Honeycomb(API 11), living under the `android.app` package. **Note**: API 11 implies that Fragments have no support for devices less than Honeycomb and, for the record, as of writing this post, [more than 50% of Android devices worldwide run versions of Android below Honeycomb](http://developer.android.com/about/dashboards/index.html). Developer dissapointed? You don't have to be, cause google has been cautious enough to add the Fragment APIs to the support library. Yay! In the support library Fragment APIs sit in the `android.support.v4.app` package. This post assumes that your `minSdk` support is below API 11. Hence we concentrate on the Fragment APIs of the support library. @@ -47,13 +47,13 @@ This is done precisely as we do it for our activity layouts. The layout contains > [fragment_common.xml](https://github.com/iontech/Fragments_Example/blob/master/res/layout/fragment_common.xml) - - - + + + <button> - + #### 2. Creating reusable Java source ##### Writing the layout's corresponding Fragment class @@ -71,7 +71,7 @@ Accessing the view elements from the layout is done exactly as we do in an Activ In Activity we access Views(a Button for our example) as follows - Button button1 = (Button) findViewById(R.id.button1); + Button button1 = (Button) findViewById(R.id.button1); In Fragment, we need to use the inflated view(if in `onCreateView()`) or get the instance of the host activity and access the views through this instance(when in a [lifecycle callback](http://developer.android.com/guide/components/fragments.html#Lifecycle "Fragment lifecycle callbacks") after `onCreateView()`, I generally do it in `onActivityCreated()`). Button button1 = (Button) view.findViewById(R.id.button1); @@ -83,7 +83,7 @@ or Finally, in `onCreateView()` we must return the View for the fragment's UI. return view; - + #### 3. Employing the reusable components in Activity ##### Making an Activity to host this Fragment This is done in two ways, statically by adding `` elements into the Activity layout or dynamically, at run time, by using `FragmentTransaction`s. @@ -97,7 +97,7 @@ If the `minSdk` is API 11 or higher, then we can leave our inheritance to `Activ Inorder to statically add a Fragment into your Activity, just add `` element with the necessary layout attributes and the `android:name` attribute set to the fully qualified class name of the corresponding Fragment. - + ##### b. Dynamic approach ###### Using `FragmentTransaction`s diff --git a/tests/utils_tests/test_module/bad_module.py b/tests/utils_tests/test_module/bad_module.py index cc0cd168ce..69444b0e54 100644 --- a/tests/utils_tests/test_module/bad_module.py +++ b/tests/utils_tests/test_module/bad_module.py @@ -1,3 +1,3 @@ import a_package_name_that_does_not_exist -content = 'Bad Module'
\ No newline at end of file +content = 'Bad Module' diff --git a/tests/utils_tests/test_module/good_module.py b/tests/utils_tests/test_module/good_module.py index 0ca689832a..f6261c5bc8 100644 --- a/tests/utils_tests/test_module/good_module.py +++ b/tests/utils_tests/test_module/good_module.py @@ -1 +1 @@ -content = 'Good Module'
\ No newline at end of file +content = 'Good Module' |
