Skip to content
Snippets Groups Projects
Select Git revision
  • c3e8cb31c100eeb11ccbfd53b7790e90d62432bd
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • release/201811
  • release/201808
  • wip/patches_poly_2017/cedryk_doucet/abderahmane_bouziane
  • releases/beta1
  • android/release_461
  • android/release_460
  • android/release_459
  • android/release_458
  • android/release_457
  • android/release_456
  • android/release_455
  • android/release_454
  • android/release_453
  • android/release_452
  • android/release_451
  • android/release_450
  • android/release_449
  • android/release_448
  • android/release_447
  • android/release_446
  • android/release_445
  • android/release_444
  • android/release_443
  • android/release_442
38 results

ViewIdlingResource.kt

Blame
    • Adrien Béraud's avatar
      c3e8cb31
      proposal: tests: introduces Espresso for integration tests · c3e8cb31
      Adrien Béraud authored
      For quality improvements, and to avoid regressions, the client should
      have automatized tests to validate transitions, contents and scenarios.
      This patch introduces two examples of tests working with Espresso, which
      is integrated with Android Studio.
      
      Some notes:
      + "pm clear" is not executed between all tests, so all the tests should
      be considered as one test-suite. If we want to make all the tests
      completely independant, the TestOrchester should execute a "pm clear"
      between two test. Also because of this, Test are ordered via
      Testxxxx.
      + To generate tests the easy way can be:
          + Disable animations on the host device
          + In Android studio, Run, Record Espresso Test
      + Sometimes, elements take time to be shown. In this case, the test
      must be completed with waiting events. waitUntilViewIsDisplayed()
      can be used for this.
      
      Change-Id: Ie44b2568fb9c8570978d1d1af94562bccba6b6b2
      c3e8cb31
      History
      proposal: tests: introduces Espresso for integration tests
      Adrien Béraud authored
      For quality improvements, and to avoid regressions, the client should
      have automatized tests to validate transitions, contents and scenarios.
      This patch introduces two examples of tests working with Espresso, which
      is integrated with Android Studio.
      
      Some notes:
      + "pm clear" is not executed between all tests, so all the tests should
      be considered as one test-suite. If we want to make all the tests
      completely independant, the TestOrchester should execute a "pm clear"
      between two test. Also because of this, Test are ordered via
      Testxxxx.
      + To generate tests the easy way can be:
          + Disable animations on the host device
          + In Android studio, Run, Record Espresso Test
      + Sometimes, elements take time to be shown. In this case, the test
      must be completed with waiting events. waitUntilViewIsDisplayed()
      can be used for this.
      
      Change-Id: Ie44b2568fb9c8570978d1d1af94562bccba6b6b2
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    string_utils.h 4.42 KiB
    /*
     *  Copyright (C) 2004-2020 Savoir-faire Linux Inc.
     *
     *  Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
     *  Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program; if not, write to the Free Software
     *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
     */
    
    #pragma once
    
    #include <string>
    #include <vector>
    #include <set>
    #include <algorithm>
    #include <regex>
    #include <iterator>
    #ifdef _WIN32
    #include <WTypes.h>
    #endif
    
    // Add string operators crucially missing from standard
    // see https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/1RcShRhrmRc
    namespace std {
    inline string
    operator+(const string& s, const string_view& sv)
    {
        string ret;
        ret.reserve(s.size() + sv.size());
        ret.append(s);
        ret.append(sv);
        return ret;
    }
    inline string
    operator+(const string_view& sv, const string& s)
    {
        string ret;
        ret.reserve(s.size() + sv.size());
        ret.append(sv);
        ret.append(s);
        return ret;
    }
    using svmatch = match_results<string_view::const_iterator>;
    using svsub_match = sub_match<string_view::const_iterator>;
    inline bool
    regex_match(string_view sv,
                svmatch& m,
                const regex& e,
                regex_constants::match_flag_type flags = regex_constants::match_default)
    {
        return regex_match(sv.begin(), sv.end(), m, e, flags);
    }
    inline bool
    regex_match(string_view sv,
                const regex& e,
                regex_constants::match_flag_type flags = regex_constants::match_default)
    {
        return regex_match(sv.begin(), sv.end(), e, flags);
    }
    inline bool
    regex_search(string_view sv,
                svmatch& m,
                const regex& e,
                regex_constants::match_flag_type flags = regex_constants::match_default)
    {
        return regex_search(sv.begin(), sv.end(), m, e, flags);
    }
    } // namespace std
    
    namespace jami {
    
    constexpr static const char TRUE_STR[] = "true";
    constexpr static const char FALSE_STR[] = "false";
    
    constexpr static const char*
    bool_to_str(bool b) noexcept
    {
        return b ? TRUE_STR : FALSE_STR;
    }
    
    std::string to_string(double value);
    
    #ifdef _WIN32
    std::wstring to_wstring(const std::string& str, int codePage = CP_UTF8);
    std::string to_string(const std::wstring& wstr, int codePage = CP_UTF8);
    #endif
    
    std::string to_hex_string(uint64_t id);
    uint64_t from_hex_string(const std::string& str);
    
    static inline int
    stoi(const std::string& str)
    {
        return std::stoi(str);
    }
    
    static inline double
    stod(const std::string& str)
    {
        return std::stod(str);
    }
    
    std::string_view trim(std::string_view s);
    
    inline
    std::vector<std::string_view> split_string(std::string_view str, char delim)
    {
        std::vector<std::string_view> output;
        for (auto first = str.data(), second = str.data(), last = first + str.size(); second != last && first != last; first = second + 1) {
            second = std::find(first, last, delim);
            if (first != second)
                output.emplace_back(first, second - first);
        }
        return output;
    }
    
    inline
    std::vector<std::string_view> split_string(std::string_view str, std::string_view delims = " ")
    {
        std::vector<std::string_view> output;
        for (auto first = str.data(), second = str.data(), last = first + str.size(); second != last && first != last; first = second + 1) {
            second = std::find_first_of(first, last, std::cbegin(delims), std::cend(delims));
            if (first != second)
                output.emplace_back(first, second - first);
        }
        return output;
    }
    
    std::vector<unsigned> split_string_to_unsigned(const std::string& s, char sep);
    
    void string_replace(std::string& str, const std::string& from, const std::string& to);
    
    std::string_view string_remove_suffix(std::string_view str, char separator);
    
    std::string string_join(std::set<std::string> set, std::string_view separator = "/");
    
    std::set<std::string> string_split_set(std::string& str, std::string_view separator = "/");
    
    } // namespace jami