forked from oppia/oppia-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix oppia#3419: Separate ViewEventLogsActivityTest into activity and …
…fragment test files (oppia#3468) * Created ViewEventLogsFragmentTest * Removed tests from ViewEventLogsActivityTest * Removed ViewEventLogsFragment from test_file_exemptions * Introduced Test Activity and added new tests * Nit fix * Nit fix * Nit fixes * Added test activities to exemption * Added missing TODOs * Nit fix
- Loading branch information
1 parent
1499137
commit 3f98e53
Showing
8 changed files
with
703 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
.../java/org/oppia/android/app/devoptions/vieweventlogs/testing/ViewEventLogsTestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.oppia.android.app.devoptions.vieweventlogs.testing | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import org.oppia.android.R | ||
import org.oppia.android.app.activity.InjectableAppCompatActivity | ||
import org.oppia.android.app.devoptions.vieweventlogs.ViewEventLogsFragment | ||
|
||
/** Activity for testing [ViewEventLogsFragment]. */ | ||
class ViewEventLogsTestActivity : InjectableAppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
activityComponent.inject(this) | ||
supportActionBar?.setDisplayHomeAsUpEnabled(true) | ||
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp) | ||
setContentView(R.layout.view_event_logs_activity) | ||
if (getViewEventLogsFragment() == null) { | ||
val viewEventLogsFragment = ViewEventLogsFragment.newInstance() | ||
supportFragmentManager.beginTransaction().add( | ||
R.id.view_event_logs_container, | ||
viewEventLogsFragment | ||
).commitNow() | ||
} | ||
} | ||
|
||
private fun getViewEventLogsFragment(): ViewEventLogsFragment? { | ||
return supportFragmentManager | ||
.findFragmentById(R.id.view_event_logs_container) as ViewEventLogsFragment? | ||
} | ||
|
||
companion object { | ||
/** Returns [Intent] for [ViewEventLogsTestActivity]. */ | ||
fun createViewEventLogsTestIntent(context: Context): Intent { | ||
return Intent(context, ViewEventLogsTestActivity::class.java) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.