expresso

Android testing preferences fragment by Expresso

ぐ巨炮叔叔 提交于 2021-02-10 05:21:24
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Android testing preferences fragment by Expresso

放肆的年华 提交于 2021-02-10 05:19:45
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to test android app has closed with Espresso

拈花ヽ惹草 提交于 2019-12-13 01:38:50
问题 How do I test if an Android application has closed after I click the native back button? I can test if an activity has opened, but how do I test if a app has closed? 回答1: I'm guessing you might be able to do it through the Instrumentation class. The idea being, if you are not able to come back to the app from the last activity from which you exited, then the app is closed. I haven't tested it but perhaps you could do something like this: Instrumentation instrumentation =

How to make balancing group capturing?

痞子三分冷 提交于 2019-12-10 05:19:58
问题 Let's say I have this text input. tes{}tR{R{abc}aD{mnoR{xyz}}} I want to extract the ff output: R{abc} R{xyz} D{mnoR{xyz}} R{R{abc}aD{mnoR{xyz}}} Currently, I can only extract what's inside the {}groups using balanced group approach as found in msdn. Here's the pattern: ^[^{}]*(((?'Open'{)[^{}]*)+((?'Target-Open'})[^{}]*)+)*(?(Open)(?!))$ Does anyone know how to include the R{} and D{} in the output? 回答1: I think that a different approach is required here. Once you match the first larger

How to make balancing group capturing?

别说谁变了你拦得住时间么 提交于 2019-12-05 10:14:39
Let's say I have this text input. tes{}tR{R{abc}aD{mnoR{xyz}}} I want to extract the ff output: R{abc} R{xyz} D{mnoR{xyz}} R{R{abc}aD{mnoR{xyz}}} Currently, I can only extract what's inside the {}groups using balanced group approach as found in msdn . Here's the pattern: ^[^{}]*(((?'Open'{)[^{}]*)+((?'Target-Open'})[^{}]*)+)*(?(Open)(?!))$ Does anyone know how to include the R{} and D{} in the output? I think that a different approach is required here. Once you match the first larger group R{R{abc}aD{mnoR{xyz}}} (see my comment about the possible typo), you won't be able to get the subgroups