/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//TESTED_COMPONENT=qtdeclarative

testcase = {

  select_text: function()
  {
       // Test meta data
       testTitle = "Text Selection";
       testBinary = "qmlscene tests/testapplications/text/text.qml";
       testGoal = "Verify text can be selected via various methods";
       testPreconditions = "None";
       testGroups = "BAT";

       // Test Steps
       prompt(twiki('---+++ ' + testTitle + '<br><br>
           *Goal:* ' + testGoal + '<br>
           *Pre-Requisites:* ' + testPreconditions + '<br>
           *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Select the Text: Short option | "Hello World" is shown |
    | Press the Select Word button | World is selected |
    | Press the Select All button | Hello World is selected |
    | Press the Select None button | No text is selected |
    | Select the Mouse: On option | |
    | Drag over some text | Only that text is selected. On a touchscreen only device the virtual keyboard may show |
    | Select the Mouse: Off option | |
    | Press the Select None button | No text is selected |
    | Drag over some text | No text is selected. On a touchscreen only device the virtual keyboard may show |'));
  },

  cut_copy_and_paste: function()
  {
      // Test meta data
      testTitle = "Cut, copy and paste";
      testBinary = "qmlscene tests/testapplications/text/text.qml";
      testGoal = "Verify selected text can be copied/cut to the clipboard, and returned";
      testPreconditions = "None";
      testGroups = "BAT";

      // Test Steps
      prompt(twiki('---+++ ' + testTitle + '<br><br>
          *Goal:* ' + testGoal + '<br>
          *Pre-Requisites:* ' + testPreconditions + '<br>
          *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Select the Text: Short option | "Hello World" is shown |
    | Press the Select All button | Hello World is selected |
    | Press the Copy Button | |
    | Press the Position End Button | Text is no longer selected, cursor is at the text end |
    | Press the Paste Button | "Hello WorldHello World" is shown  |
    | Press the Select Word button | World is highlighted |
    | Press the Cut button | World is removed from the text |
    | Press the Paste button | "Hello WorldHello World" is shown |'));
  },

  password_echo_mode: function()
  {
      // Test meta data
      testTitle = "Password Echo";
      testBinary = "qmlscene tests/testapplications/text/text.qml";
      testGoal = "Verify password echo modes display text correctly";
      testPreconditions = "None";
      testGroups = "BAT";

      // Test Steps
      prompt(twiki('---+++ ' + testTitle + '<br><br>
          *Goal:* ' + testGoal + '<br>
          *Pre-Requisites:* ' + testPreconditions + '<br>
          *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Select the Text: Short option | "Hello World" is shown |
    | Select the Echo: Password option | Hello World is now a string of asterisks |
    | Enter an exclamation mark | An asterisk is added to the string |
    | Select the Echo: None option  | No text is visible |
    | Enter an exclamation mark | No text is shown |
    | Select the Echo: OnEdit option | A string of asterisks is shown |
    | Enter an exclamation mark | An exclamation mark appears at the end of the asterisks, but shortly becomes an asterisk |
    | Select the Echo: Normal option | Hello World!!! is now displayed |'));
  },

  styling: function()
  {
       // Test meta data
       testTitle = "Text Styling";
       testBinary = "qmlscene tests/testapplications/text/text.qml";
       testGoal = "Verify text can be displayed using generic styling";
       testPreconditions = "None";
       testGroups = "BAT";

       // Test Steps
       prompt(twiki('---+++ ' + testTitle + '<br><br>
           *Goal:* ' + testGoal + '<br>
           *Pre-Requisites:* ' + testPreconditions + '<br>
           *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Select the Text: Short option | "Hello World" is shown |
    | Select the Bold: On option | Hello World is now in bold |
    | Press the Italics: On option | Hello World is now in italics |
    | Press the Strikeout: On option | Hello World now has a line passing through it |
    | Press the Underline: On option | Hello World is now underlined | '));
  },

  cursor_behavior: function()
  {
       // Test meta data
       testTitle = "Cursor Behavior";
       testBinary = "qmlscene tests/testapplications/text/text.qml";
       testGoal = "Verify the text cursor displays correctly";
       testPreconditions = "None";
       testGroups = "BAT";

       // Test Steps
       prompt(twiki('---+++ ' + testTitle + '<br><br>
           *Goal:* ' + testGoal + '<br>
           *Pre-Requisites:* ' + testPreconditions + '<br>
           *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Enter enough text into the field such that it passes beyond the far right | The text scrolls to the left when the edge is reached |
    | Select the Autoscroll: Off button | The far left edge shows the first character of the text |
    | Select the Cursor: Off option | The cursor disappears |
    | Select the Cursor: On option | The cursor appears | '));
  },

  capitalization: function()
  {
      // Test meta data
      testTitle = "Capitalization";
      testBinary = "qmlscene tests/testapplications/text/text.qml";
      testGoal = "Verify character capitalization behaves correctly";
      testPreconditions = "None";
      testGroups = "BAT";

      // Test Steps
      prompt(twiki('---+++ ' + testTitle + '<br><br>
          *Goal:* ' + testGoal + '<br>
          *Pre-Requisites:* ' + testPreconditions + '<br>
          *Tested Binary:* ' + testBinary + '<br>

    | *Step* | *Verification* |
    | Execute '+testBinary+' | "The TextInput item displays an editable line of text." is displayed |
    | Select the Cap10n: Upper option | The text is converted to all upper case |
    | Select the Cap10n: Lower option | The text is converted to all lower case |
    | Select the Cap10n: SmallCaps option | The text is converted to all small sized upper case characters |
    | Select the Cap10n: Capitals option | The text is shown with each first character of every word capitalized | '));
  }
}