Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

82 linhas
2.0 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by gapic-generator. DO NOT EDIT.
  15. package texttospeech
  16. import (
  17. texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1"
  18. )
  19. import (
  20. "context"
  21. "fmt"
  22. "strconv"
  23. "testing"
  24. "time"
  25. "cloud.google.com/go/internal/testutil"
  26. "google.golang.org/api/iterator"
  27. "google.golang.org/api/option"
  28. )
  29. var _ = fmt.Sprintf
  30. var _ = iterator.Done
  31. var _ = strconv.FormatUint
  32. var _ = time.Now
  33. func TestTextToSpeechSmoke(t *testing.T) {
  34. if testing.Short() {
  35. t.Skip("skipping smoke test in short mode")
  36. }
  37. ctx := context.Background()
  38. ts := testutil.TokenSource(ctx, DefaultAuthScopes()...)
  39. if ts == nil {
  40. t.Skip("Integration tests skipped. See CONTRIBUTING.md for details")
  41. }
  42. projectId := testutil.ProjID()
  43. _ = projectId
  44. c, err := NewClient(ctx, option.WithTokenSource(ts))
  45. if err != nil {
  46. t.Fatal(err)
  47. }
  48. var text string = "test"
  49. var input = &texttospeechpb.SynthesisInput{
  50. InputSource: &texttospeechpb.SynthesisInput_Text{
  51. Text: text,
  52. },
  53. }
  54. var languageCode string = "en-US"
  55. var voice = &texttospeechpb.VoiceSelectionParams{
  56. LanguageCode: languageCode,
  57. }
  58. var audioEncoding texttospeechpb.AudioEncoding = texttospeechpb.AudioEncoding_MP3
  59. var audioConfig = &texttospeechpb.AudioConfig{
  60. AudioEncoding: audioEncoding,
  61. }
  62. var request = &texttospeechpb.SynthesizeSpeechRequest{
  63. Input: input,
  64. Voice: voice,
  65. AudioConfig: audioConfig,
  66. }
  67. if _, err := c.SynthesizeSpeech(ctx, request); err != nil {
  68. t.Error(err)
  69. }
  70. }