languageSettingAppTest function

Future<MatrixAppTest> languageSettingAppTest()

The test of the setting of the language, the entry that the template of the localization role gives the settings screen, which the CLI keeps in its app_tests/language_setting, for the apps with the localization role and the settings screen role, whichever modules provide them. On the settings screen, the setting shows its title and, as the value of its row, the choice of the user, the languages of the device while the user chose none. A tap opens a sheet over the main navigation of the app, with an option for the languages of the device and one for each language of the app, by its name in that language, or its code, with the chosen one selected and checked. A tap on an option closes the sheet: the app and the texts of the setting are in the language of the option, which is saved under LocalizationRole.localeKey, and the option of the device removes what was saved. On a small phone with a large text size, the choice is below the title of the setting, and the sheet scrolls. A second file of the test starts the app on a device that prefers the last language of the app: the app and the setting follow the device, the setting names a choice of that same language that code makes, the next start restores the language that was saved, and the sheet has no option but those of the app and of the device.

The test knows only the two roles. The matrix writes the widget of the entry for it into languageSettingFile, from the entries of the settings screen role of the app, with the labels of the languages of the app and the texts of the setting in each of them, from the localization role. It opens the settings screen with the helper of the tests of the settings screen role that the CLI keeps, which every app with the settings screen role has too.

Implementation

Future<MatrixAppTest> languageSettingAppTest() async => MatrixAppTest(
      '${await appTestsDirectoryOf('smf_flutter_cli')}/language_setting',
      appliesTo: (app) => app.hook!.presentRoles
          .containsAll({localizationRole, settingsScreenRole}),
      generatedFiles: _languageSettingOf,
      roles: {localizationRole},
    );